1

Is it possible to retain the original array?
I have this array

let array = [2, 1, 5, 4],
    sorted_array = array.sort();

And when i log it

console.log(array) //this will return the sorted one.

Is there any way to retain the original array? or i'm just doing it wrong..

0

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.