fools-pyrite

computer toucher; RPG enjoyer


my roommate looked up from his computer in frustration and said “how do I get Chrome’s dev tools to print out the value of an object at log time, and not when I expand it later?”

There may be a good answer, but here is the very bad one I gave him:

const logForReal = console.log
console.log = (…args) => logForReal(…JSON.parse(JSON.stringify(args)))

The object can’t change out from under you if you monkey-patch console.log to clone it!

If anyone does know a better way I’m now curious lol


You must log in to comment.

in reply to @fools-pyrite's post: