DEV Community

pooyaalamdari
pooyaalamdari

Posted on

event loop - micro task - promise

function logOne() {
    console.log('1');
}

function main() {
    setTimeout(logOne, 0);
    Promise.resolve(2)
        .then(val => val * 2)
        .then(console.log);
    console.log('3');
}

main();
Enter fullscreen mode Exit fullscreen mode

Image description

Image description

Top comments (0)