javascript reverse array without modifying code example
Example 1: javascript reverse array without modifying
var newarray = array.slice().reverse(); //returns a reversed array without modifying the original
Example 2: javascript splice without changing array
var myArray = ["one", "two", "three"];
var cloneArray = myArray.slice();
myArray.splice(1, 1);
console.log(myArray);
console.log(cloneArray);