जॉइन Examsbook
1161 0

प्र: What is an error-first callback ?

  • उत्तर देखेंउत्तर छिपाएं
  • Workspace

उत्तर :
व्याख्या :

Error-first callbacks are used to pass errors and data as well. You have to pass the error as the first parameter, and it has to be checked to see if something went wrong. Additional arguments are used to pass data.   fs.readFile(filePath, function(err, data) { if (err) { // handle the error, the return is important here // so execution stops here return console.log(err) } // use the data object console.log(data)})

क्या आपको यकीन है

  त्रुटि की रिपोर्ट करें

कृपया संदेश दर्ज करें
त्रुटि रिपोर्ट सफलतापूर्वक जमा हुई