Skip to content

Instantly share code, notes, and snippets.

@c4milo
Created May 18, 2012 23:45
Show Gist options
  • Save c4milo/2728203 to your computer and use it in GitHub Desktop.
Save c4milo/2728203 to your computer and use it in GitHub Desktop.
var MyClass = function() {
this.cosa = 0;
console.log('constructor');
};
(function() {
var func1 = function() {
console.log('func1');
console.log(this.cosa);
}.bind(this);
this.func2 = function() {
console.log('func2');
func1();
};
}).call(MyClass.prototype);
var i = new MyClass();
i.func2();
@c4milo
Copy link
Author

c4milo commented May 19, 2012

Shouldn't line 9 print 0?

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