Posted On: Jan 12, 2023
Callback is a function that is passed as an argument to another function and is executed after some event or action occurs. The function that accepts the callback is often referred to as the "parent" function, and the function that is passed in as an argument is referred to as the "callback" function.
In Node.js, callbacks are used extensively to handle asynchronous operations. For example, when reading a file or making an HTTP request, the Node.js runtime will not wait for the operation to complete before moving on to the next line of code. Instead, it will pass a callback function that will be executed when the operation is completed.
Pros of Callback in Node.js:
Cons of Callback in Node.js:
Never Miss an Articles from us.