Bizarre console.log behaviour in Chrome Developer Tools [duplicate]

Try this instead:

var a = []; console.log(a.toString()); a.push(1); console.log(a.toString());

It’s not that the order of evaluation is strange, I bet, but that the conversion of the objects to printable form happens after the statements are all executed, at the point when Chrome is ready to actually dump out the log.

Leave a Comment