3 ms·
A debugger is very useful when you trace a piece of code that 1) you understand well and 2) executes relatively linearly. JavaScript is pretty terrible at both.
by teambayleaf 7y ago
A debugger is very useful when you trace a piece of code that 1) you
understand well and 2) executes relatively linearly. JavaScript is
pretty terrible at both.
First of all, most JavaScript apps are just a small chunk of code that
sit on frontend frameworks (React etc). This means that using a debugger,
you mostly step through framework's internal code base, of which you have
a vague understanding at best.
Also, an average JavaScript code hops around -- to put it mildly --
crazily, due to the heavy usage of anonymous functions, callbacks and
other very cleaver abstractions.
This is why placing a bunch of console.log beats tracing with a debugger.
- curioussavage 7y agoWhat? It jumps around because it’s running in an event loop. Not because JS devs try to do too many clever things. You hope it jumps around often or you might be blocking the loop for too long.