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

420
Views
¿Las instrucciones de la cola de microtareas tienen mayor prioridad que las instrucciones de nivel raíz?

 const anotherAsync = async () => { console.log('Another async called'); for (let i=0; i<=100000; i++) { } console.log('Another async finished'); }; const func = async () => { console.log('async func called'); anotherAsync(); console.log('async func finished'); }; const run = async () => { console.log('calling async func'); await func(); console.log('done'); }; run();

El resultado:

 calling async func async func called Another async called Another async finished async func finished done

Aquí, como puede ver, estoy esperando solo en la función func . no se espera anotherAsync . Entonces, lógicamente, asumiría que la async func finished y done imprimió antes. Another async called como anotherAsync() debería estar en la cola de microtareas hasta que la pila de llamadas aún no esté vacía. Pero aquí no parece ser el caso.
Apreciaré si alguien puede ayudarme a entender por qué se imprime Another async function async func finished la función asíncrona

Mi suposición es que, anotherFunc es parte de func , por lo que await on func activa una espera implícita en anotherFunc o prioriza la ejecución de esas instrucciones para esa función.

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!