Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

reverse array javascript

let arr = [1,2,3]
let newArr = arr.slice().reverse(); //returns a reversed array without modifying the original
console.log(arr, newArr) //[1,2,3] [3,2,1]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #reverse #array #javascript
ADD COMMENT
Topic
Name
3+7 =