Why does console.log output modified values even before they have been modified?
google-chrome, google-chrome-devtools, javascript
Solution
It doesn't.
When you output an object with `console.log`, the object is output "by reference"; the values in the console are dynamic, and they will update to reflect the current state of the object.
If you want to output a static string of text about the object, use `console.dir`
Problem
In Chrome 39 developer tools, this code: ``` var something = [ {x: 'foo'}, {x: 'foo'} ]; console.log(something); something.forEach(function (element) { element['x'] = 'baz'; }); ``` ... outputs: Why does `console.log` output modified values even before they have been modified? A similar question from 2012 explains that due to a chromium bug, `console.log` is "delayed" (does not stringify the input object immediately). But the bug is marked as fixed, so why is this still happening several years later?