> await only really replaces .then()s and can't (as far as I know) achieve an effect like Promise.all()
Although it's not completely equivalent to a Promise.all, you can actually use vanilla await with basically the same effect as promise.all(). Like so: [0]
const timeout = ms => new Promise(res => setTimeout(res, ms));
(async () => {
const startTime = Date.now();
const first = timeout(1000);
const second = timeout(500);
const third = timeout(800);
await first;
await second;
await third;
console.log(`Function completed in ${Date.now() - startTime} ms`)
})();
This should output the completion time as somewhere very near to 1000ms. The reason they aren't completely equivalent is if one promise fails in Promise.all they all immediately fail whereas this only throws once you await the failed promise. Of course you could also use `await Promise.all([...])` in async/await too. You could try this in your browser console (I got it to log the output in chrome, but not safari for some reason) or you could go to link [0] and try it on jsfiddle.