Skip to content

Instantly share code, notes, and snippets.

@hughfdjackson
Forked from c4milo/why.js
Created May 19, 2012 00:12
Show Gist options
  • Save hughfdjackson/2728271 to your computer and use it in GitHub Desktop.
Save hughfdjackson/2728271 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);
};
this.func2 = function() {
console.log('func2');
func1.call(this);
};
}).call(MyClass.prototype);
var i = new MyClass();
i.func2();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment