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..

Jiel
  • 103
  • 1
  • 2
  • 12

0 Answers0