Ever wondered how many different ways you can write a reverse string algorithm in JavaScript?

You can use a combination of helper methods built into JavaScript:

split(”);
The split method separates the string into substrings, which are separated by a given separator. The separator can be a blank space, comma or whatever you need.

reverse();
The reverse method changes the order of the element in the array in situ at call time. The zeroeth element will become the last element in the array and the last element the first in the array.

join(”);
The join method will recombine all the given items in the array and then return the array.

Categories: JavaScript