Skip to content

Instantly share code, notes, and snippets.

@escusado
Created November 11, 2013 03:56
Show Gist options
  • Save escusado/7407598 to your computer and use it in GitHub Desktop.
Save escusado/7407598 to your computer and use it in GitHub Desktop.
Class('MyParenClass')({
prototype : {
init : function (options){
this.myName = 'minombre'
return this;
}
}
});
Class('MyChildrenClass').inherits(MyParenClass)({
prototype : {
init : function(){
console.log('this will fail', this.name);
this.constructor.init.call(this);
console.log('this is ok', this.name);
}
}
});
var myInstance = new MyChildrenClass();
myInstance.name // -> 'mi nombre'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment