WBE_Praktikum_5/code/async/promise-wait.js

12 lines
237 B
JavaScript
Raw Normal View History

2022-10-27 08:21:03 +02:00
//
// wait returns a promise that is resolved after some time
//
function wait (ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}
wait(2000).then(() => console.log("first"))
wait(2000).then(() => console.log("second"))