3 ms·
I often always do this to deep print my javascript object. console.log(JSON.stringify(myObject, null, 4));
by christiansakai 6y ago
I often always do this to deep print my javascript object. console.log(JSON.stringify(myObject, null, 4));
- tantalor 6y agoThis is great trick because the console will keep a reference to your object, not a copy, so if it changes between the time it was logged and now then the log expando shows the new value, not the old value. By printing out the object you get a point-in-time snapshot rather than a reference to a mutable object.
- christiansakai 6y agoYup, learned it the hard way lol.