JSFiddle - React, Tailwind, and code Playground
JavaScript
var waitUntil = function (c, then) {
if (!c) {
return then.call();
} else {
return setTimeout(function () {
waitUntil(c, then);
}).call();
}
};
var a = 1000;
var b = a;
waitUntil(b, function () {
console.log('then');
})();
while (b--) {
}
//console.log(b);