JSFiddle - React, Tailwind, and code Playground
by Bjolja
HTML
<span id="result"></span>
JavaScript
function GetMonkeyValue() {
var defferedMonkey = $.Deferred();
var LoopTo = 5;
var Loop = 0;
var MyInterval = setInterval(function () {
if (Loop++ == LoopTo) {
clearInterval(MyInterval);
defferedMonkey.resolve("Apa");
}
}, 1000);
return defferedMonkey;
}
GetMonkeyValue().done(function(monkeyvalue){
$("#result").text(monkeyvalue);
});