What is the output of the following? “`js const promises = [1,2,3].map(n => new Promise(resolve => setTimeout(() => resolve(n * 2), n * 100)) ); Promise.all(promises).then(results => console.log(results)); “`
Key points
- Promises are resolved in the order they are created
- The setTimeout delays the resolution of each promise
- Promise.all waits for all promises to resolve before logging the results
Ready to go further?
