a()
b()
async function a() {
for (n=1; n<100; n++) {
console.log('a', n)
await sleep(1)
}
}
async function b() {
for (n=1; n<100; n++) {
console.log('b', n)
await sleep(3)
}
}
function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
})
}
To embed this program on your website, copy the following code and paste it into your website's HTML: