Skip to content

Instantly share code, notes, and snippets.

@kcoyner
Last active December 6, 2019 14:55
Show Gist options
  • Save kcoyner/3a257398c383ed938e934489090491dd to your computer and use it in GitHub Desktop.
Save kcoyner/3a257398c383ed938e934489090491dd to your computer and use it in GitHub Desktop.
function getMoneyBack(money, callback) {
money = String(money) // force the error
if (typeof money !== 'number') {
callback(null, new Error('money is not a number'))
// callback(new Error('money is not a number'))
} else {
callback(money)
}
}
getMoneyBack(1200, function(money) {
console.log(money)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment