js reverse array without mutating code example
Example 1: array reverse without mutating
var newarray = array.slice().reverse();
Example 2: javascript reverse array without modifying
var newarray = array.slice().reverse(); //returns a reversed array without modifying the original