How to make async calls with "for of" loop code example
Example: wait for loop to finish javascript
async function processArray(array) {
// map array to promises
const promises = array.map(delayedLog);
// wait until all promises are resolved
await Promise.all(promises);
console.log('Done!');
}