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

164
Views
Need difference - setTimeout(callback, 0) vs $(window).load

What's the difference between these? Will event loop be formed after the page load got finished ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

They are so different that it isn't really worth comparing them.


Binding an event handler to the load event will call that function when:

  • The load event fires (which is after the page and all its non-async dependencies have loaded) and
  • The event loop isn't busy with something else

Passing a function to setTimeout with a time of 0 will call that function when:

  • 0ms have passed and
  • The minimum timeout for the JS engine has passed and
  • The event loop isn't busy with something else (which includes the script which called setTimeout in the first place
about 4 years ago · Juan Pablo Isaza Report
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!