AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
# 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 ```