Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

201
Views
When a recursive function returns itself to a caller, who makes that subsequent call?
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?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!