You can use slice() to make a copy then reverse() it
var newarray = array.slice().reverse();
var array = ['a', 'b', 'c', 'd', 'e'];
var newarray = array.slice().reverse();
console.log('a', array);
console.log('na', newarray);
More Related Contents:
- Filter JSON by key value with JavaScript
- fetch first element of every string in array using javascript [closed]
- Accesing 2d arrays from Javascript [closed]
- How to remove all duplicates from an array of objects?
- Determine whether an array contains a value [duplicate]
- Best way to find if an item is in a JavaScript array? [duplicate]
- Most efficient way to create a zero filled JavaScript array?
- Sort array of objects by single key with date value
- What is “undefined x 1” in JavaScript?
- Check if an array is empty or exists
- Why Array.indexOf doesn’t find identical looking objects
- Explanation of [].slice.call in javascript?
- What is the performance of Objects/Arrays in JavaScript? (specifically for Google V8)
- How to filter an array in javascript?
- Get unique results from JSON array using jQuery
- Compare 2 arrays which returns difference
- Getting a list of associative array keys
- How to find duplicate values in a JavaScript array of objects, and output only unique values?
- How much faster are arrays than accessing Google Sheets cells within Google Scripts?
- Getting index of an array’s element based on its properties
- Javascript remove all occurrence of duplicate element, leaving the only one that is unique
- JavaScript: Remove duplicates of objects sharing same property value
- Sieve of Eratosthenes algorithm in JavaScript running endless for large number
- JavaScript filter array by data from another
- How do I unset an element in an array in javascript?
- javascript – match string against the array of regular expressions
- How to find the coordinate that is closest to the point of origin?
- Can a JavaScript variable be used in plain HTML?
- Can forEach in JavaScript make a return? [duplicate]
- Why does the `map` method apparently not work on arrays created via `new Array(count)`?