These two loops look similar, but the first logs "done" before the saves finish:
js async function saveAll(items) { items.forEach(async item => { await save(item); }); console.log('done'); }
js async function saveAll(items) { for (const item of items) { await save(item); } console.log('done'); }
my understanding is that forEach ignores the promises returned by its callback, while the for...of version awaits each save in the outer function.
if the saves are independent, would await Promise.all(items.map(save)) be the right concurrent version, and what changes if one save rejects?