It will execute code at the end of the current event loop cycle. setImmediate() will execute after any I/O operations in the current event loop and before any timers scheduled (setInterval(), setTimeout()) for the next event loop.
console.log("Hello");
let data=()=>{
console.log("Hi");
}
setTimeout(() => {
console.log('set Timeout Call');
}, 0);
setImmediate(()=>{
console.log("set Immediate Call")
})
process.nextTick(()=>{
console.log('next Tick call');
})
data();
console.log("Bye");
Output:- Hello
Bye
Hi
next Tick call
set Immediate Call
set Timeout Call
Bye
Hi
next Tick call
set Immediate Call
set Timeout Call