function Person()
{Person.prototype.say = function() {return "Person say";};
Person.prototype.name=123;
this.name=223;
}
p=new Person();
alert(p._proto_==p.constructor.prototype);//false??应该是ture啊??
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
你拼写错了
p._proto_是undefined,正确的拼写是p.__proto__,应该输出的是true,__.proto__属性就是一个指向对象原型的指针alert(p._proto_==p.constructor.prototype);//为什么ture啊??
p._proto_ 哪跑出来的没看懂
你代码写法有问题,prototype的定义应该写在构造函数外边,你这么写,每new一次,就重新定义一次prototype ,多余了