JSFiddle - React, Tailwind, and code Playground
by cedric_tarou
JavaScript
all();
async function all() {
start();
await countdown(5);
next();
}
function start() {
console.log("start");
}
function next() {
console.log("next");
}
function countdown(sec) {
return new Promise(resolve => {
console.log(sec)
sec -= 1
setTimeout(() => {
countdown(sec);
resolve()
}, 1000)
})
}