What's the first argument passed to a Node Js callback handler?

devquora
devquora

Posted On: Feb 22, 2018

 

In Node Js all core modules, as well as most of the community-published modules, follows a pattern where the first argument to any callback handler is an error object. this object is optional, if there is no error then in that case null or undefined is passed to the callback.

Example of the callback function

function callback(err, results) {
	// usually we'll check for the error before handling results
	if(err) {
		// handle error somehow and return
	}
		// no error, perform standard callback handling
}

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Node JS Interview Questions

    What is Node js ?

    Node Js is one of the most popular and powerful server technologies today. It allows you built the entire website only..

    Node JS Interview Questions

    Explain CLI in Node.js?

    CLI stands for Command Line Interface. It is a utility or program on your computer where users type commands to perform..

    Node JS Interview Questions

    In which Language Node Js is written ?

    Node js is written in C, C++,JavaScript.It uses Google’s open source V8 Javascript Engine to convert Javascript code..