WBE_Praktikum_5/code/async/promise-wait.js

12 lines
237 B
JavaScript

//
// 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"))