hasOwnProperty()方法用于检测一个对象是否含有特定的自身属性,返回一个布尔值
function Fn() {
this.age = 'wm'
}
Fn.prototype.sex = '女'
var obj = new Fn()
// 实例化对象会继承构造函数里的属性和方法
console.log(obj.hasOwnProperty('age')) // true
console.log(Fn.prototype.hasOwnProperty('age')) //false
console.log(obj.hasOwnProperty('sex')) // false