Which is the first argument typically passed to a Node.js callback handler?
By convention, lots of libraries were passing an error message as the first argument to make it easier to check for errors.
function doThis(callback){
callback(error, data);
}
doThis( error, data => {
if (error) handleError(); // error
console.log(data); // success
})
As more code is moving to use Promise, this convention may disappear leaving developers with no real answer to this question.
This text was originally published in quora.