I would like to understand why situation 1 and situation 2 don\'t return the same results.
Situation 1 :
var array1 = [\"1\", \"2\", \"3\"];
var arra
In Situation 1
The reverse method transposes the elements of the calling array object in place, mutating the array, and returning a reference to the array.
In Situation 2 you have the same reference. You are printing array1 array before reverse it.
var array1 = ["1", "2", "3"];
var array2 = array1;
console.log(array1); // [ '1', '2', '3' ]
console.log(array2.reverse()); // [ '3', '2', '1' ]
console.log(array1); // [ '3', '2', '1' ]