3 ms·
As an added benefit, `for...of` works with async, unlike forEach.
by cehrlich 5y ago
As an added benefit, `for...of` works with async, unlike forEach.
- dragonwriter 5y agoIf I would be tempted to use forEach but can’t because async, I usually don’t want for…of semantics, though. I probably want something like await Promise.all(collection.map(thing => some_async_function(thing))); instead of: for thing of collection { await some_async_function(thing); }