构造函数,原型对象,实例对象的关键词

一,constructor ;  实例对象指向构造函数

二,prototype ; 构造函数执行原型对象

三,__proto__   ;每个对象都有的,指的继承的原型对象,最上一级是Object

四,hasOwnproperty() : 可以检测一个属性是存在实例中,还是存在原型中,知在给定属性存在于对象实例中时,才会返回true.

person1.hasOwnproperty("name")

 五,isPrototypeOf();  检测对象是否存在继承关系

Person.prototype.isPrototypeOf(person1)  //true

 六,propertyIsEnumerable ,判断属性是否可以枚举。

猜你喜欢

转载自www.cnblogs.com/xianxiaoan/p/11083234.html
今日推荐