Quiz · Asynchronous code · lesson 11 of 12
Quiz — the order of Promise.all values
What does the program print (lines separated by spaces)?
function wait(ms, value) {
return new Promise((resolve) => {
setTimeout(() => resolve(value), ms);
});
}
Promise.all([wait(30, "a"), wait(10, "b")])
.then((values) => console.log(values.join(" ")));
console.log("start");Subscribe to take the course
The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.