Skip to content

Instantly share code, notes, and snippets.

@kozie
Created April 1, 2014 21:06
Show Gist options
  • Save kozie/9923220 to your computer and use it in GitHub Desktop.
Save kozie/9923220 to your computer and use it in GitHub Desktop.
'var that = this' vs. 'Function.call'
MyObjectThingy.prototype.someFunction = function () {
var that = this;
OtherObject.doSomethingWithACallback(123, function () {
that.done();
});
};
MyObjectThingy.prototype.someFunction = function () {
OtherObject.doSomethingWithACallback(123, function () {
that.done();
}.call(this));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment