DEV Community

Discussion on: Why async code is so damn confusing (and a how to make it easy)

Collapse
 
tomerbendavid profile image
Tomer Ben David • Edited

What about debugging it in most cases although the syntax makes it easy I'm not sure about debugging...

Collapse
 
joelnet profile image
JavaScript Joel

You actually have less debugging because all of your functions become testable.

Try unit testing this:

for (var i = 1; i < 6; i++) {
  setTimeout(() => console.log(i), 1000)
}

hint: it sucks.