
JavaScript Developer Console
What your mother never told you ;-)
console.log info icon
Ever seen the little info icon at the right of a console output and wondered what it means — like in the following example:

Position your mouse pointer above it and wait a second for the tooltip that says: “Value below was just evaluated now”.
What does that mean?
It simply says hey, what you will see here maybe is not the value you want to see here, because we look just now into the object and that could have been changed after the console log has been processed.
So if you really want the actual value at this point in code you should log it with JSON.stringify, otherwise you will get the latest value.

The example above simply illustrates this. I have expanded the object after I have changed the value of a.a to 2 and as expected it shows 2 for a.a.
JSON.stringify
Every now and than I use the above method to log objects to the console and as many times I wish the output would be pretty printed. And guess what, it is already there, because the method takes optional two arguments. The second optional one gives you the ability to set the spacing for the pretty printer.
So a call with 2 adds 2 spaces indent:

And it can even do more. With the first optional parameter you can change the output by replacing or omitting elements, but that’s another story.