← Back to challenges

Move Capital Letters to the Front

JavaScriptHardstringsformattingregex

Instructions

Create a function that moves all capital letters to the front of a word.

Examples

capToFront("hApPy") ➞ "APhpy"

capToFront("moveMENT") ➞ "MENTmove"

capToFront("shOrtCAKE") ➞ "OCAKEshrt"

Notes

Keep the original relative order of the upper and lower case letters the same.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Instant JAZZ