DEV Community

Discussion on: Array.map() + async/await

Collapse
havespacesuit profile image
Eric Sundquist

Using Promise.all(items.map(async (item) => asyncFunc(item)) looks pretty, but if you have thousands of items, it can eat a lot of your browser's resources managing all those promises. If resource consumption is a concern, there is nothing wrong with for (const item of items) { await asyncFunc(item) }.