Consider this snippet, where a function b
gets a promise and calls itself when it is resolved in order to get another promise:
var a = function () {
var timeout = 1000;
let time_promise = new Promise((resolve, reject) => {
let success = false;
setTimeout(()=> {
document.getElementById('log').appendChild(document.createTextNode("Called "));
resolve();
}, timeout);
});
return time_promise;
};
var b = function() {
a().then(()=>{
//is the first b() released after this call?
b();
});
};
b();
my question is: is the first call to b released after it called itself? Note the call to itself is inside a function called when then
must be called.