JavaScript and __proto__ - what browsers use it?

后端 未结 4 606
臣服心动
臣服心动 2020-12-06 00:59

What web browsers use the __proto__? Mozilla states that:

Note that __proto__ may not be available in JavaScript versions ot

4条回答
  •  遥遥无期
    2020-12-06 01:36

    This is not direct answer to the question but it may help for those who wanna know the prototype of the object instance (this is for what __proto__ is often used). All modern browsers (including IE9) supports getPrototypeOf() which can be used to determine the object's prototype. The irony of fate is that some still actual browsers like IE7 and IE8 that don't support Object.getPrototypeOf(obj) don't support obj.__proto__ as well. For those browsers you can use obj.constructor.prototype. However it is a bit dangerous because this property can be redefined.

提交回复
热议问题