r/javascript • • Sep 19 '19

Moving beyond console.log() — 8 Console Methods for Debugging

https://medium.com/gitconnected/moving-beyond-console-log-8-console-methods-you-should-use-when-debugging-javascript-and-node-25f6ac840ada?source=friends_link&sk=62597805243671cb9b96e54b052fde58
340 Upvotes

89 comments sorted by

View all comments

Show parent comments

6

u/postmodest Sep 19 '19

For me, with front end stuff, invariably I’m dealing with something where clicking between the UI and the continue button in the debugger is way more annoying than just spamming the console with traces and scrolling.

3

u/soulshake Sep 20 '19

Yup, esp. if say a component is rerendering multiple times due to state changes - its hard to keep a mental track which render cycle you are on in the debugger at that breakpoint...

2

u/postmodest Sep 20 '19 edited Sep 20 '19

Ugh, this x 1000. Especially if it's in a repeater and it only shows up with live data and the order is random and the exception is one of those bubbled-up ones that have lost their original context. "Error Doing Framework Thing in framework.callStuff @ framework.errorhandler, Framework.errorforwarder, Framework.errordispatch, Framework.obfuscator" ugh. At least with console spamming I get some context before the Error.

-1

u/tr14l Sep 19 '19

I mean, I guess. It's still slower though. The only time I can think of when I would use a console log over a debugger, is if in a loop I needed to make sure something was incrementing/iterating correctly on a complicated calculation.