JSFiddle - React, Tailwind, and code Playground
by index
JavaScript
function sleep(delay) {
var start = new Date().getTime();
while (new Date().getTime() < start + delay){}
}
function foo1() {
sleep(2);
console.log('foo1');
}
function foo2() {
console.log('foo2');
}
async function foo3() {
await foo1();
foo2();
}
foo3();