Category : settimeout

Suppose I have 3 setTimeouts like below: console.log(new Date().toLocaleTimeString()); setTimeout(() => { console.log(new Date().toLocaleTimeString()); }, 3000); setTimeout(() => { console.log(new Date().toLocaleTimeString()); }, 6000); setTimeout(() => { console.log(new Date().toLocaleTimeString()); }, 9000); Since Node is single threaded, execution of each timeout should be one after the other. Hence the output should be as expected as below: 9 ..

Read more