Skip to content

Instantly share code, notes, and snippets.

@caseycrites
Created January 17, 2014 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caseycrites/8483662 to your computer and use it in GitHub Desktop.
Save caseycrites/8483662 to your computer and use it in GitHub Desktop.
Something.prototype.aFunction = function() {
var _this = this
this.collection.forEach(_this.bFunction)
this.collection.forEach(function(item) {
_this.bFunction(item)
})
}
Something.prototype.bFunction = function(item) {
// invoked from line 4, this is 'Window'
// invoked from line 6, this is 'Something'
console.log(this)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment