JavaScript Basic Learning Series-prototype chain mode

Source: Internet
Author: User

1, the demo code is as follows:

2. Draw as follows:

3. Rules:

1) Each function data type (normal function/Class) has a naturally-built property:prototype (prototype), and this property is the value of an object data type

2) and prototype on the browser was born to add a property Construtor (constructor), the property value is the current function (class) itself

3) Each object data type (normal object, instance, prototype ...) Born with a property:__proto__ (Two _ each), the attribute value is the prototype of the class to which the current instance belongs (prototype)

4)object is the base class for all object data types in JS (topmost class)

5) There is no __proto__ this attribute on Object.prototype

4, summarized as follows:

5. The results are as follows (control Drawing):

function () {  // modify own private sumfunction() {// Modify sum on the owning class prototype }

JavaScript Basic Learning Series-prototype chain mode

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.