Created
January 30, 2011 00:11
-
-
Save icio/802351 to your computer and use it in GitHub Desktop.
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
function bad (foo) { | |
if ( ! (foo instanceof Bar) ) { | |
throw new TypeError("This is an annoying restriction!"); | |
} | |
return foo.baz(foo.quux(10)); | |
} | |
function good (foo) { | |
if ( !foo.baz || !foo.quux ) { | |
throw new TypeError("We need foo to have baz and quux methods."); | |
} | |
return foo.baz(foo.quux(10)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment