Explain Event loop in Node.js?

Answer

The Event loop in Node.js handles all asynchronous callbacks in an application.
It is an essential part of Node.js as Node.js (or JavaScript) is a single-threaded, event-driven language.
A listener can be attached easily to an event with the callback provided by the listener when the event occurs.
All callbacks functions are queued on a loop and then executed after the other after the response has been received.
When functions like setTimeout, fs.readFile, and HTTP.get are called, the event loop is executed by Node.js, and it continues with further code without waiting for output.
Once the operation is finished, it receives the output and then runs the callback function.

All react js Questions

Ask your interview questions on react-js

Write Your comment or Questions if you want the answers on react-js from react-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 ---