I tried executing the code in Chrome Developer Console and i got this odd result which am not able to understand
var arr = [[2,2]];console.log('Array is',arr);arr[0] = [3,3]
The output i got after executing this is
Array is [[3,3]]
The assignment should happen after the console.log
had been executed.But it magically happened before that.
To clarify i tried running the same code in JsBin.However in JSBin i got the expected out which is
Array is [[2,2]]
However this code yields expected result in chrome
var arr = [2,2];console.log('Array is',arr);arr[0] = 3;console.log(arr)
Output
Array is [2,2] [3,2]
Can someone help me understand this.