Reverse a String
A staple of every coding interview. Strings have no built-in reverse, but
arrays do β so the trick is: split β reverse β join.
"abc".split(""); // ["a","b","c"]
["a","b","c"].reverse(); // ["c","b","a"]
Your task
Write reverseString(str) that returns the string reversed.
β‘ 30 XP
solution.jsRuns in your browser
Loading editorβ¦
Tests3 to pass
"hello" β "olleh"
empty string
"Boots" β "stooB"
Run your code to check these.