SetTimeout0IsSynchronous
DRAFT

Misconception:

Calling setTimeout(f, 0) is equivalent to a synchronous call of the function f.

Incorrect

Scheduling the execution of a function after 0 milliseconds with setTimeout is equivalent to a synchronous call

Correct

Scheduling the execution of a function after 0 milliseconds with setTimeout is not equivalent to a synchronous call

Correction
Here is what's right.

The setTimeout method is used to schedule the execution of a function after a certain number of milliseconds. Even though 0 (and even negative numbers) can be passed as a second argument, this does not mean that the function is going to be called immediately. On the contrary, setTimeout “enqueues” the event of executing the supplied function, which can be executed not before the next event cycle.

Language

JavaScript

Concepts

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.