Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js reverse

const array1 = ['one', 'two', 'three'];
console.log('array1:', array1);
//["one", "two", "three"]

const reversed = array1.reverse();
console.log('reversed:', reversed);
//["three", "two", "one"]

// Careful: reverse is destructive -- it changes the original array.
console.log('array1:', array1);
//["three", "two", "one"]
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #js #reverse
ADD COMMENT
Topic
Name
3+4 =