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
Rename Default Branch on Github Read tip
Awesome Github Profile READMEs Read tip
Restrict an Object in JavaScript Read tip