9 Tricks for Kickass JavaScript Developers in 2019
Lukas Gisder-Dubé
7.4K34

(First of all, good job on the article, i encourage you to write more)

“1. async / await

If you’re still stuck in callback hell, 2014 wants its code back.”

— Async await looks blocking, which is not how JS works. the only good reason for using async await if and only if there is complete consistency and promises are not used. Otherwise it’s just making too much of a mess with both of them in the codebase. Callback mess is not a problem in JS since a long time, only people coming from OOP or beginners generally have this issue early on. It requires some time to get used to FP and the type of ‘event-loop’ thinking and side-effects.

2. for…of

— Why would you use an imperative for of over an array of async. What you need there is exactly a case of RxJS or stream processing-type computation. Your code looks a lot like a procedural code, only that it’s not at all and the timeline is hard to pin down. Imagine a more complicated issue where you would have to mix the results of 2 of the operations, then you would need a cache and so on and you would need to go into some anti-patterns and over-engineering.