JavaScript Basics-Objects

Source: Internet
Author: User

Principle

All things are objects. Suppose ' Mulder ' (Me) as an object. The properties of the MoD are name, gender, age, etc. Mulder's behavior is eating, walking, sleeping and so on. The interaction between Mulder and others is an object. Object corresponds to an entity in the world. Class, which is the classification of managed objects. If the MoD is a specific object. A man is a class. person is the interface.

How to Build

Singleton object: JSON

Common objects:

(function (w,m) {    = function () {        // constructor function   Invitefriends () {};         // prototypes        Invitefriends.prototype = {            ' invitefriends ',            ...        }         return New   invitefriends (). init ();}    ;}) (Window,  window.) HB);

Inherited

  Off Topic

Basic usage of objects: combination, inheritance.

Combination, where an object introduces another object. The two are interwoven together to accomplish a function.

notation

To inherit the parent class's construction method

     Supertype.call (this, arguments);

Inherit the prototype chain of the parent class

         var prototype = Object (suptype.prototype);          = subtype;          = prototype;

principle

, each object will have a prototype object that is pointed to by a hidden reference [[prototype]]. In the prototype object, [[prototype]] points to the parent object, and the layer is traced back to object.

    

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.