多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# hasOwnProperty属性 检测对象上的属性和方法,只能检查私有的,不能检测公有的 ```javascript function Person(name, age) { //私有的 this.name = name; this.age = age; } Person.prototype = { //公有的 constructor:Person, study:function () { console.log(this.name,this.age); }, say:function () { console.log(this.name," say hello"); } } var p = new Person("zs",10); console.log(p.hasOwnProperty("name"));//true console.log(p.hasOwnProperty("study"));//false console.log(p.hasOwnProperty("name222"));//false ```