async function parentFunction() {
try {
await taskFunction(xyz);
return true;
} catch (e) {
console.log(e);
}
});
async function taskFunction(xyz) {
try {
const done = await someAsyncTask(xyz);
if !(done) {
return taskFunction(xyz); // recursion
}
return true;
} catch (e) {
console.log(e);
}
});
To help me better understand what is going on behind the scenes, when the task function returns itself to the caller (because there are more tasks to complete), behind the scenes, is the task function returning itself to the caller and the caller then makes that subsequent call? Or is the task function calling itself and then returning the boolean through this chain of calls?