Affiliate link

Node.js Functions - Callbacks

Callbacks are functions that are passed as arguments to other functions and are called when an operation is complete. Callbacks are the most basic form of asynchronous programming in Node.js.

function add(a, b, callback) {
    var sum = a + b;
    callback(sum);
}

add(2, 3, function(result) {
    console.log(result); // prints 5
});
Affiliate link
Affiliate link
Advertisment
Fiverr
Ad - SiteGround WooCommerce hosting - best home for your online store. Fast WooCommerce, Free SSL, Top support. Learn more.
rocket.net