-1
我有以下的元典調用父函數重載JavaScript的原型時
var Parent = function(){}
Parent.prototype.doSomething = function(){
console.log("As a parent I did like a parent");
}
var Child = function(){}
Child.prototype = new Parent();
Child.prototype.doSomething = function(){
console.log("As a child I did like a child");
//This is where I am not sure what to put
}
我想這2條線
As a child I did like a child
As a parent I did like a parent
當然第一個是簡單的,但我不知道如何/如果我可以調用父功能,一旦它被覆蓋。
以下是您的示例:http://jsfiddle.net/zu097ep4/ – dfsq 2014-09-25 14:21:10