// Array.prototype.forEach is not designed for asynchronous code. // Instead use await Promise.all to process all in parallel if the order doesn't matter. await Promise.all(array.map(async (element) => { await someFunction(element); }))