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
Front Matter CMS for VSCode Read tip
Use Sudo Without Password Prompt in Scripts Read tip
Restrict an Object in JavaScript Read tip