Hello Friends 👋,
Welcome To Infinitbility! ❤️
reverse() method transposes the elements of the calling array object in place, mutating the array, and returning a reference to the array.
reverse() method with an example.
1const array1 = ['one', 'two', 'three'];2console.log('array1:', array1);3// expected output: "array1:" Array ["one", "two", "three"]45const reversed = array1.reverse();6console.log('reversed:', reversed);7// expected output: "reversed:" Array ["three", "two", "one"]89// Careful: reverse is destructive -- it changes the original array.10console.log('array1:', array1);11// expected output: "array1:" Array ["three", "two", "one"]
Thanks for reading…
Join our email list and get notified about new content
No worries, I respect your privacy and I will never abuse your email.
Every week, on Tuesday, you will receive a list of free tutorials I made during the week (I write one every day) and news on other training products I create.