JavaScript Advanced Programming Chapter sixth object-oriented programming

Source: Internet
Author: User
Object-Oriented Programming

ECMA-262 defines an object as: "A collection of unordered attributes whose properties can contain basic values, objects, or functions." "Strictly speaking, this is equivalent to saying that the object is a set of values that do not have a particular order. Each property and method of an object has a name, and each name is mapped to a value.

6.1 Understanding Objects

The simplest way to create an object is to create an instance of an object and then add properties and methods to it, as shown here:

var person = new Object ();p erson.name = ' Yyg ';p erson.age = 23;person.job = ' student;person.sayname () = function () {    ale RT (THIS.name);    }

This is the first method used by the developer, and several years later, the object arguments are the preferred mode for creating such objects. The code is as follows

var person = {    ' yyg ',    $,    ' student '        }

  

  

JavaScript Advanced Programming Chapter sixth object-oriented programming

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.