Skip to content

setTimeout with zero delay #270

@narayanasuri

Description

@narayanasuri

Example

setTimeout with 0 for delay

setTimeout(() => { console.log("A"); }, 0); console.log("B"); 

Explanation

setTimeout being a part of the Web APIs, maintains its own call stack and then pops its callbacks to the callback/task queue. Only when the traditional call stack is empty, does JavaScript refer to the callback queue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    new-exampleA proposal of the new example

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions