JavaScript's prototype chain diagram

Source: Internet
Author: User

90% of the front-end or JS programmers or teachers do not understand JavaScript more than this

to the phone.



But all the brown one-way arrow chains in this diagram are the prototype chains of JavaScript (color annotations are critical to understanding the JS prototype chain)

Each of the __proto__ constructor. Prototype is an internal object so the painting is for brevity.

For example, if you consider __proto__ as an internal object into a



The prototype chain is



Constructor and prototype if you put it in the appropriate position as an internal object, it's going to be a marijuana regiment. I can't remember anything.

Please look at This is the actual JavaScript prototype chain diagram Hey

The prototype chain is invisible most of the time (__proto__ is visible in Firefox Nodejs) so the graph is back to




The three features of the previous figures

1. All objects are on the prototype chain

2. Except null each object has a unique __proto__ prototype object

3. In addition to NULL, Object.prototype, the prototype object of other objects is unreachable. __proto__ operation Access but the prototype property of a constructor (function) on the prototype chain can be accessed

JS Coder Most of the time to face is

Elegant, huh:-()

All JavaScript heavy codes are the elements of the above diagram, but you have to have at least

If even this picture is not easy to remember the simplest of the Iron Triangle JavaScript 99% is the result of the Metamorphosis

The shadow part does not move (of course you are willing to make a kavascript is also personal freedom but that's not JavaScript) will destroy the structure of the prototype chain and the sealing of JS programming for the Chaigai of the prototype chain is the non-shaded part of the lower left corner

Considering that __proto__ prototype constructor are internal objects,

So the actual diagram should be



JavaScript's prototype chain diagram

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.