Firstly, I have lines of code like this
var arr = [1];
console.log("first: ", arr);
arr.push(2);
console.log("second: ", arr);
arr.push(3);
console.log("third: ", arr);
and it outputs
first [1,2,3]
second [1,2,3]
third [1,2,3]
I have no idea why it is that.. Actually, it is a test that I attempt after having a lot of trouble with console.log and array on my project, it shows the array object with strange items that I never added to the array before (actually, after) but the array length is correct and if i check each item, it is also correct.. My friend explains me that Javascript executes the console.log "slower" than arr.push, is that true? Doesn't javascript follow the formal sequence code flow like other languages? And how can I prevent that? Console.log is very important for me and now I does not confident with its output anymore :(