TLDR Web Dev · MISCELLANEOUS

WHY DO BROWSERS THROTTLE JAVASCRIPT TIMERS?

nolanlawson.com8 min read

Summary from the TLDR Web Dev newsletter

JavaScript's setTimeout(0) can actually run 4 milliseconds later. A lot of websites spam setTimeout, so browsers set the delay to avoid draining users' batteries or other issues. Developers could just use other alternatives. While these options can still be abused, they are permitted for now.