Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

156
Vistas
Clarification on how asynchronous functions queue with each other

I'm very new to JavaScript, please bear with me if this is quite obvious.

I was watching this video about the event queue and I wrote this code segment to try and see if I understood how JavaScript queues asynchronous functions into their section (I'm not sure what it's called. In the video, it called it a webapi).

setTimeout( () => console.log('hello'), 5000);
setTimeout( () => console.log('123'), 5000);

From my understanding, the first line of code gets sent off to a separate thread where it starts to get evaluated. Then, the second line of code gets sent off to another thread (different from the first) to get evaluated. As each of these evaluations complete in their own separate threads, they will eventually call their callback function, adding it to the task queue, where the event loop will push them back into the main stack.

I'm hoping someone can confirm or correct me on this, and would appreciate any further reading to help solidify this idea. I have to admit, when I first started reading about asynch functions, I was puzzled since I thought JavaScript was single threaded (so how could it yield any benefits?). I know, foolish.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda