JSFiddle - React, Tailwind, and code Playground
JavaScript
const loopAsync = async iter => new Promise(resolve => {
let n = 0;
while (n < iter * 1000000000) n++;
console.log("done")
resolve(n);
});
loopAsync(5).then(console.log);
console.log('Main thread');