4 ms·
Stop using .then wherever possible. (and also avoid using .map for side effects! Prefer foreach for!)
by jschrf 4y ago
Stop using .then wherever possible.
(and also avoid using .map for side effects! Prefer foreach for!)
- voreny 4y agoHow would using async/await help here? It has the same issue of implicitly awaiting the Promise that is returned from an `async` function. In fact, your comment inspired me to go into more depth regarding the problems of `async`/`await` syntax: https://news.ycombinator.com/item?id=33322184 https://news.ycombinator.com/item?id=33322184 As for `.map`, I was referring the monadic `.map`, not `Array.prototype.map`. Either way, I agree `.map` is not for side-effects. The article says nothing about side-effects, so I'm not sure where this remark is coming from.