// reverseString() export function reverseString(str) { return str.split("").reverse().join(""); } // str.reverse() String.prototype.reverse = function(){ return reverseString(this); }
freeCodeCamp ⟩ Three Ways to Reverse a String in JavaScript 1. array.reverse() 2. for-loop 3. recursion
array.reverse() - reverse in place. ⭐️
arr.reversed()
Last updated 2 years ago