var counter = 3;
function runThePromise(){
prom = new Promise(function(rslv, rej){
console.log('checking what is thing');
setTimeout(function(){
console.log('resolved');
rslv();
counter--;
if(counter>0) runThePromise();
},4000);
});
return prom;
}
A simple promise recursive call.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.