JavaScript prototype, prototype chain God diagram

Source: Internet
Author: User

Understand the following diagram to understand JS prototype, prototype chain

1, each object has its own prototype object, each object has a prototype property, which is a pointer to the object's prototype object, the prototype object holds a bunch of specific types of instances of the properties and methods shared, the prototype object also has its own prototype object.

2. When customizing a constructor, its prototype object gets the constructor property, which points to the custom function.

3. The instance created by the constructor has a pointer [[Prototype]], a prototype object to the constructor, and __proto__ is a nonstandard, but many browser-implemented property that allows you to view the prototype object.

4, when accessing an object's properties or methods, if the object is not, JS will automatically find the prototype object, if its prototype object is not on the prototype object to find, and so on, so that the chain lookup process is called the prototype chain, the end of the prototype chain is NULL, By definition Null has no __proto__.

JavaScript prototype, prototype chain God 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.