Skip to content

Instantly share code, notes, and snippets.

@joshkehn
Created October 20, 2011 21:08
Show Gist options
  • Save joshkehn/1302393 to your computer and use it in GitHub Desktop.
Save joshkehn/1302393 to your computer and use it in GitHub Desktop.
var Laws = {
drinking_age : function (fn) {
fn(this.age > 21);
}
}
/* snip */
Laws.drinking_age.call(this, function (able_to_drink) {
@dancrowley303
Copy link

This doesn't work unless you also pass the context in the fn call within drinking_age:

drinking_age : function (fn) { fn.call(this, this.age > 21); }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment