JavaScript prototype Mode learning

Source: Internet
Author: User

1. Each function created has a prototype (prototype) attribute. This property is a pointer to an object. The purpose of this object is to include properties and methods that can be shared by all instances of a particular type. The literal meaning is that prototype is the prototype object of the object instance that was created by invoking the constructor. The advantage of using a prototype object is that it allows all object instances to share the properties and methods that it contains.

2. Whenever a new function is created, a prototype property is created for the function based on a specific set of rules. This property points to the prototype object of the function. By default, all prototype objects will automatically get a constructor (constructor) property. This property contains a pointer to the function where the prototype property is located.

The instance uses the isPrototypeOf () method to determine whether there is a structural relationship between objects, Person.prototype.isPrototypeOf (Person1);

JavaScript prototype Mode learning

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.