原型式继承:function object(o){ function clone(){};
clone.prototype=o; return new clone();
}function parent(name){ this.position=1; this.name=name;
}parent.prototype.getLevel=function(){ console.log("hello");
}var children=object(parent);这时运行:children.getLevel(); //children.getLevel is not a function(…)children.prototype.getLevel();//hello为什么会产生两种不同的结果?
添加回答
举报
0/150
提交
取消