However, it seem that the ordering is a bit different, from my test, it is more like: process.nextTick, setTimeout/setInterval, setImmediate.
Here is the sample test code and result (Node.JS v4.1.0):
setImmediate(function() {
console.log("from setImmediate");
});
setTimeout(function() {
console.log("from setTimeout");
}, 10);
process.nextTick(function() {
console.log("from process.nextTick");
});
console.log("hello");
output:
hellofrom process.nextTickfrom setTimeoutfrom setImmediate
Useful for someone having difficult in the relevant subject. Thanks for this blog. I can share it with my friend. Have a great day!
ReplyDeleteHi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Node JS Online Training from India . or learn thru Javascript Online Training from India. Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Online Training
ReplyDelete