I know this might be a noob questions, but when I handle error for mongodb, why don't we put a condition like this in inside the if statement?
For example
query.findOne(function (err, kitten) {
if (err === true) {
console.log(err);
} else if (!err) {
console.log("success");
}
}
How is if(err)
equivalent to if(err===true)
?