日期:2014-05-16 浏览次数:20413 次
function Person(){} var person = new Person(); Person.prototype={//重写Person原型 name:'zhangsan', sayHi:function(){ alert("重写原型") } } //person.sayHi();这里会报错 function Person1(){} var person1 = new Person1(); Person1.prototype.sayHi = function(){ alert("hello prototype") } person1.sayHi();//这里能正常执行