r/javascript • • Mar 18 '19

What's your favorite, most useful javascript one-liner?

385 Upvotes

422 comments sorted by

View all comments

95

u/tbicknell3 Mar 19 '19

debugger;

14

u/thisguyfightsyourmom Mar 19 '19

Even with all the cool tools in the chrome inspector, dropping a debugger in the source is so quick, easy, and effective

I’m always a little embarrassed when I start typing them while pairing though

2

u/Hanlonsrazorburns Mar 19 '19

I wrote a little piece using environment variables that turns debugger on locally as well as different levels of logging in my code. It's been very helpful.

2

u/snifty Mar 19 '19

Debugging is embarrassing?

→ More replies (5)

4

u/IntelligenceOptional Mar 19 '19

Just make sure your linter reminds you to dedebugger...

→ More replies (3)

2

u/TwiNighty Mar 19 '19

I used to use it all the time. Now I only use it when I have no sourcemaps (which is very rare). Other times I just add a breakpoint, which is way easier to manage.