Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

reverse array in js

const array1 = ['one', 'two', 'three'];
console.log('reversed:', array1.reverse());
// Note that reverse() is destructive -- it changes the original array.
console.log('array1:', array1);
// expected output: "array1:" Array ["three", "two", "one"]
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #reverse #array #js
ADD COMMENT
Topic
Name
7+1 =