SATURN  RING  STATION

At a distant space view post, we chat about codes.

JavaScript lesson learnt: Don’t trust console.log(object);

Doing my first angular app. Got stuck with a problem that my naive trust of “console.log(object);” leading me to the wrong direction of debugging.

“console.log(object);” only prints the object at the latest state of execution. Not at the state the line is been executed.

Use below code instead!

console.log(JSON.stringify(object));

 

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

JavaScript lesson learnt: Don’t trust console.log(object);