I am trying to get a for loop to wait until it's resolved.
This is where I am but it's not working...
function myotherfunction() {
// do something
console.log("myotherfunction");
}
async function myfunction() {
var arr = ['one', 'two', 'three'];
for (let i = 0; i < arr.length; i++) {
await new Promise(resolve => {
myotherfunction();
console.log('done');
});
}
}
myfunction()
How to I fix my syntax?