JavaScript OOP proto and prototype prototype diagram

Source: Internet
Author: User

"_proto_ and Prototype"

1.prototype (prototype function): The function has a prototype.prototype is an object that points to the reference address of the current constructor.

2._proto_ (object's prototype object): All objects have _proto_ properties. When an object is instantiated with a constructor, the _proto_ property of the new object is referred to as the prototype of the constructor.
Zhangsan._proto_==person.prototype
All objects will eventually point to the prototype of object ()

"Prototype Chain"
1. The _proto_ of the new object is directed to the prototype of the constructor through the constructor new object.
2. _proto_ of all functions refers to the prototype of the upper function
3. _proto_ of the object that is not a constructor new ({} The prototype of the new object () object) points to the prototype of object
4.Object _proto_ points to null

JavaScript OOP proto and prototype prototype 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.