Call the parent method.How to implement?
function Ch() {
this.year = function (n) {
return n
}
}
function Pant() {
this.name = 'Kelli';
this.year = function (n) {
return 5 + n
}
}
//extends
Pant.prototype = new Ch();
Pant.prototype.constructor = Pant;
pant = new Pant();
alert(pant.name); //Kelli
alert(pant.year(5)) //10
How to сall the parent method
this.year = function (n) {
return 5 + n
}
in object?Thank you all for your help