Home >Web Front-end >JS Tutorial >Summary of methods to obtain the prototype object of an object in Javascript_javascript skills
In Javascript, if we have an object but don’t know its constructor, how do we get its prototype object?
In Chrome or FireFox browser, we can directly use the __proto__ attribute of the object to obtain its prototype object.
However, the __proto__ attribute was not supported in IE until IE11.
So in a browser that does not support the __proto__ attribute, how do we get the prototype object of the object? Can be obtained indirectly through constructor.
The constructor property is not a property of the object itself, but is obtained from the prototype object along the prototype chain. This property points to the constructor corresponding to this prototype object. The prototype attribute of the constructor points to the prototype object, so we can get it indirectly.
The above is the entire content of this article about obtaining prototype objects in JavaScript. I hope you will like it.