当Parent.one不是函数时,我收到错误。请解释为什么在构造函数构造的对象中发生这种情况,而不是在我们正常定义对象时。
var Parent = function(){};
Parent.prototype = {
one: function(){
console.log("bye");
},
two: function(){
console.log("hello");
Parent.one();
}
}
var Child = new Parent();
Child.two(); // logs "hello" and then throws an error that Child.one is not a function.