Reversing a string
JavaScript doesn’t have a reverse() method for strings but has one for arrays. The trick is to convert a string to an array, reverse the array and combine the array back into a string:
var s = "Hello World!";
var reversed = s.split("").reverse().join("");
// "!dlroW olleH"