Reversing An Array
var arr = [1, 2, 3, 4, 5]; arr.reverse(); // returns [5, 4, 3, 2, 1]
If you're trying to reverse a string, you'll need to split it up into separate characters then join it back together in order to reverse the string itself.
var website = ['CodeSnippet']; website.reverse(); // returns ['CodeSnippet'];
Shoot me an email at
firstname.lastname@example.org with any questions and if you enjoyed this, stay tuned and subscribe below! 👇