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);
Related Contents:
- How to check if array is empty or does not exist? [duplicate]
- Find a value in an array of objects in Javascript [duplicate]
- Most efficient way to convert an HTMLCollection to an Array
- Remove array element based on object property
- How to get the first element of an array?
- Remove all elements contained in another array
- What is the most efficient way to concatenate N arrays?
- Most efficient way to prepend a value to an array
- Fastest way to convert JavaScript NodeList to Array?
- Counting the occurrences / frequency of array elements
- Javascript Array.sort implementation?
- JavaScript Array to Set
- How to delete an item from state array?
- Create array of all integers between two numbers, inclusive, in Javascript/jQuery
- Opposite of push(); [duplicate]
- Objects are not valid as a React child. If you meant to render a collection of children, use an array instead
- JavaScript: Difference between .forEach() and .map()
- Merge 2 arrays of objects
- How to know if two arrays have the same values
- What is the fastest or most elegant way to compute a set difference using Javascript arrays?
- Compare JavaScript Array of Objects to Get Min / Max
- Javascript – remove an array item by value [duplicate]
- javascript filter array multiple conditions
- How to convert array into comma separated string in javascript [duplicate]
- to remove first and last element in array
- Obtain smallest value from array in Javascript?
- Why can I add named properties to an array as if it were an object?
- Removing undefined values from Array
- Should negative indexes in JavaScript arrays contribute to array length?
- JavaScript – Nuances of myArray.forEach vs for loop
- JavaScript runtime complexity of Array functions
- Javascript: how to dynamically create nested objects using object names given by an array
- How to copy all items from one array into another?
- .flat() is not a function, what’s wrong?
- Sort Array by ISO 8601 date
- JavaScript push to array
- Can I append an array to ‘formdata’ in javascript?
- Difference between ( for… in ) and ( for… of ) statements?
- Getting the size of an array in an object
- Convert array of objects into array of properties [duplicate]
- Delete vs splice on associative array
- Find all possible subset combos in an array?
- How to sort an array of objects by date?
- Array functions in jQuery
- Byte array to Hex string conversion in javascript
- A function is larger than an array?
- Call function with array of arguments
- Javascript – check array for value [duplicate]
- What is the equivalent of Python any() and all() functions in JavaScript?
- How to remove all element from array except the first one in javascript