Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

202
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda