I'm trying to extend functionality from using prototypes, but keep getting Maximum call stack size exceeded, basically, I'm doing this:
var Parent = function() {};
Parent.prototype.init = function(options){
this.val_one = options.one;
/*more init code*/
};
var Child = function() {
Parent.call(this);
};
Child.prototype = Parent.prototype;
Child.prototype.init = function(options) {
this.val_two = options.two;
//I also need val_one and all the initiation placed on the parent while keeping the init method name, (shadowing while extending?)
Parent.prototype.init.call(this, options);
//will result in a self loop
//copy all the method for adding a single extra value? is this the only way to do achieve this?
};
Any help will be appreciated.