Since both falls in the "Timers" phase of Event Loop in Javascript/Node.js -
let racer = function () {
setInterval(() => { console.log('Interval is here') }, 2000);
setTimeout(() => { console.log('Timeout is here') }, 2000);
}
Just looking for initial order of execution of above code snippet?
setIntervalwill be executed and then thesetTimeout. As for which callback will fire first, it's almost guaranteed to be the interval, then the timeout.