Created
May 13, 2014 20:58
-
-
Save aroman/15565eb7f533216fd4db to your computer and use it in GitHub Desktop.
named closures
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// is this... | |
mongoose.connection.on('error', function onConnectionError(err) { // Closure is named | |
console.log('Error: Can not connect to DB'.red); | |
console.log(err.toString().red); | |
process.exit(1); | |
}); | |
// ...better than this? | |
mongoose.connection.on('error', function (err) { // Closure is NOT named | |
console.log('Error: Can not connect to DB'.red); | |
console.log(err.toString().red); | |
process.exit(1); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment