Promises and async functions are like you're code is a hard worker. But it has too much to do by itself so it says to it's useless coworker sitting doing nothing "do this and come back to me with the results while I carry on with this"
Await is when your code needs the result from that so you say await that result.
Side note. If it's JavaScript you can only call await inside an async function.
I am an OpenEdge (aka Progress) developer that loves clean code and good looking applications that are easy to use. My main pet project is the Progress DataDigger
the code waits until result1 is set and just then continue to result2.
if you want to wait for them both to complete and then continue your code you need to use
await Promise.all([result1, result2])
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.
Promises and async functions are like you're code is a hard worker. But it has too much to do by itself so it says to it's useless coworker sitting doing nothing "do this and come back to me with the results while I carry on with this"
Await is when your code needs the result from that so you say await that result.
Side note. If it's JavaScript you can only call await inside an async function.
So if you have this code (from Davyd above)
Does the code wait until result1 is set and then continue with result2 or does it just make both calls and wait until both are ready?
the code waits until result1 is set and just then continue to result2.
if you want to wait for them both to complete and then continue your code you need to use
await Promise.all([result1, result2])