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

139
Views
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
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!