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

140
Vistas
setTimeout executing synchronously?

I'm new to Javascript and trying to understand async programming. So I wrote the below code in chrome developer tools workspace -

console.log("hi1");
setTimeout(console.log("hi-async"),1000);
console.log("hi3");

The out put I was expecting was -

hi1
hi3
hi-async

Instead, the console printed following, without the 1 second delay (all at once) -

hi1
hi-async
hi3

So basically, the setTimeout function was executed synchronously! Can someone tell me why that's the case? I thought setTimeout is an async function and will always be executed asynchronously. Am I wrong? Thanks!

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