what is event-driven programming in node js
// event-driven programming in node
-> Event-driven programing:
In computer programming, event-driven programming is a programming paradigm
in which the flow of the program is determined by events such as user actions
(mouse clicks, key presses), sensor outputs, or message passing from other
programs or threads
-> Event-driven programming in node:
- Node.js uses events heavily and it is also one of the reasons why
Node.js is pretty fast compared to other similar technologies.
-As soon as Node starts its server, it simply initiates its variables,
declares functions and then simply waits for the event to occur.
In an event-driven application, there is generally a main loop that
listens for events, and then triggers a callback function when one
of those events is detected.