constructors, prototype objects, and their instance objects

Source: Internet
Author: User

The constructor has a prototype property that points to the prototype object

The instantiated object has a [[prototype]] property that points to the prototype object prototype object that has a constructor property that points to the constructor. If an object in the instance overrides a property or method in the prototype object, the connection to the prototype is cut off by this property or method. Even if the property or method is set to null later, the connection is not restored. Only the delete operator can be completely removed. Note: This property is called after setting the property to NULL, the display is null, the method is set to null and the method is called, which shows the object is not a function. After the object prototype is rewritten using the literal method, the constructor of the object's prototype no longer points to the constructor, but to object. JS Advanced P155 In addition, each constructor prototype has only one: "JS advanced" P167function supertype () {
This.color = ["Red", "Blue"];
}
Function subtype () {};
Subtype.prototype = new Supertype (); Executes only once, using a new
var a = new subtype ();
var B = new subtype ();
Console.log (A.color = = B.color);  True to create a custom type of three popular methods: 1. Combining the constructor pattern with the prototype pattern (using constructors to define instance properties, using prototypes to define shared properties and methods) JS Advanced P159 2. The combination inherits "JS advanced" P169 3. Parasitic combined inheritance "JS advanced" P172

constructors, prototype objects, and their instance objects

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.