What is the difference between setImmediate() and setTimeout()?

Answer

The setImmediate() function is meant to execute a single script once the current event loop is complete.

The setTimeout() function is used to hold a script and schedule it to be run after a certain time threshold is over.

The order of execution will solely depend on the context in which the functions are called. If called from the main module, the timing will be based on the performance of the process.

 

 

All node.js Questions

Ask your interview questions on node-js

Write Your comment or Questions if you want the answers on node-js from node-js Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---