Skip to content

When you pass zero to setTimeout, you’re asking JavaScript…

“When you pass zero to setTimeout, you’re asking JavaScript to run your timeout handler as soon as it possibly can — and this leads to your handler running as frequently as it possibly can.” quote by Eric Freeman
Download Open image
““When you pass zero to setTimeout, you’re asking JavaScript to run your timeout handler as soon as it possibly can — and this leads to your handler running as frequently as it possibly can.””

Eric Freeman

About This Quote

This interpretation was drafted with AI assistance. It is one reading of the quote, not the author's own explanation.

Setting zero delay in setTimeout causes the callback to execute as fast as the event loop permits, often leading to excessive, uncontrolled executions.

In simple terms: Zero delay makes the function run as often as possible.

Key Takeaway

Avoid zero delay; use requestAnimationFrame or throttling.

Themes

performance asynchronous event loop

Mood

cautious analytical

Type

technical advisory

When to use this quote

  • UI animations
  • data polling
  • real‑time updates
  • debounce implementations

Key Concepts

JavaScript timing throttling

Questions to Reflect On

  • Do you need that frequency?
  • Could a lower frequency suffice?
A Different Perspective

Zero delay can still block the main thread and cause jank.

★ ★ ★ ★ ★ No ratings yet

More by Eric Freeman

Explore all 90 Eric Freeman quotes

More Technology quotes

Browse all 18,164 Technology quotes