So, if you change your log to take a copy of the array:
var arr = ["1", "2", "3"]; arr.push("4"); console.log(arr.slice()); arr.push("5"); console.log(arr.slice());
Everything works as expected.
I track live tracking as an opportunity because the following example does not display any real tracking data:
var arr = ["1", "2", "3"]; console.log(arr); var i; i = setInterval(function(){ arr.push(1); console.log(arr); if(arr.length>10)clearInterval(i) },1000);
This means that logging is queued and the queue does not start until the last click on the array (probably until your javascript finishes executing).
Nice to find ... definitely something that can catch the developers.
source share