Skip to content

Instantly share code, notes, and snippets.

@waynerobinson
Last active August 29, 2015 13:57
Show Gist options
  • Save waynerobinson/9733839 to your computer and use it in GitHub Desktop.
Save waynerobinson/9733839 to your computer and use it in GitHub Desktop.
var caller = function(val, cb) {
var result = cb(val);
if (result == 1) {
return true;
}
else {
console.log("Invalid response " + result);
}
console.log("I'm never shown if result == 1");
}
caller(1, function (v) { return v * 1; });
// returns true
caller(1, function (v) { return v * 2; });
// returns undefined (fal'cie)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment