I have been a programmer for years now. Javascript seems to be the most quirky language I have came across so I am very stuck as to how I can perform this task.
My question is how can I override the constructor of a parent with prototype. For example:
This works:
function Superclass(arg1, arg2) {
alert(this.arg1);
alert(this.arg2);
}
function Subclass() {
}
Subclass.prototype = new Superclass();
//I am instituting the superclass as I do not know how to override the perant's method
var SubclassInstance = new Superclass("arg1", "arg2");
This won't work though:
function Superclass(arg1, arg2) {
alert(this.arg1);
alert(this.arg2);
}
function Subclass() {
//for this example I have not coded any behaviour for the subclass
}
Subclass.prototype = new Superclass();
//I am instituting the superclass as I do not know how to override the perant's method
var SubclassInstance = new Subclass("arg1", "arg2");
Thanks all