how to run two for loops asynchronously in js code example
Example 1: javascript + sync for loop
for(const elment of arrayElements) {
await yourFunc(elment)
await yourOtherFunc('somePatameter')
}
Example 2: 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!');
}