hasOwnProperty的使用

2019-12-11  本文已影响0人  读心的心

function Person(name, age, job) {
this.name = name;
this.age = age;
this.job = job;
}
console.log(new Person("xuelian","","微信小程序"));
console.log(Person.hasOwnProperty("name"));//true
/**

const person1 = new Person1();
console.log(person1.name);

console.log("name" in person1);//true
console.log(person1.hasOwnProperty("name"));//false

上一篇 下一篇

猜你喜欢

热点阅读