Skip to content

Instantly share code, notes, and snippets.

@seansullivan
Created October 11, 2010 20:15
Show Gist options
  • Save seansullivan/621133 to your computer and use it in GitHub Desktop.
Save seansullivan/621133 to your computer and use it in GitHub Desktop.
var FeedCat = function () {
this.cat = 'Garfield';
this.feed = function (scope_) {
var scope = scope_;
var feedIt = function (food) {
scope.doFeed(food);
}
return feedIt;
}(this);
}
FeedCat.prototype.doFeed = function (food) {
console.log('Feeding '+this.cat+' '+food+'.');
}
var feedingTime = new FeedCat();
feedingTime.feed.call(this, 'lasagne');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment