functionwork(n){returnnewPromise(resolve=>{setTimeout(()=>{resolve(n*10);},200);})}(asyncfunction(){array=[1,2,3];for(leti=0;i<array.length;i++){// it WILL wait here. constresult=awaitwork(array[i]);// result is 10, 20, 30 as expectedconsole.log(result);}})();
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Actually,
async
works as expected in for loop.