Skip to content

setTimeout Execution Time

View on Twitter

💡 A common misconception of setTimeout is:
"Execute this function in (exactly) x ms"

When in reality, you should think of it as:
"Execute this function no earlier than x ms"

setTimeout guarantees a *minimum* delay, but can't guarantee exact execution time

You might also like
Colour Contrast for Accessibility Read tip
Synchronous Container Startup in Docker Compose Read tip
Large Node.js Project Example to Learn From Read tip