我得到当我试图调用pranet方法这个错误: Uncaught TypeError: Cannot read property 'call' of undefined
http://jsfiddle.net/5o7we3bd/
function Parent() {
this.parentFunction = function(){
console.log('parentFunction');
}
}
Parent.prototype.constructor = Parent;
function Child() {
Parent.call(this);
this.parentFunction = function() {
Parent.prototype.parentFunction.call(this);
console.log('parentFunction from child');
}
}
Child.prototype = Object.create(Parent.prototype);
Child.prototype.constructor = Child;
var child = new Child();
child.parentFunction();