💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
# 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 ```