Object of Java Script Foundation

Source: Internet
Author: User

Object:

All things in JavaScript are objects: strings, numbers, arrays, functions ...

In addition, JavaScript allows custom objects to be customized.

Create: Var myobject={}; Declare object literal variable

Add Value: var myobject.name= "Jener";

var myobject.age=25;

Code format:

var person = {
Name: "Zhangsan",
AGE:25,
Say:function () {
Alert ("Speak Chinese");
}
}

Grammar: Point syntax person.name; Person.say ();

  prototype of the constructor     Person.prototype = {       say:function () {         console.log (' I am saying ');       }     }  constructor Function Person     () {      //  Hermit action      //var this = Object.create (person.prototype);            Returns the setting of the object property        this.name = ' lyl ';        This.age =;  Hermit operation        //return this;     }     var person1 = new Person ();     Console.log (Person1.name); Lyl     Person1.say ();//i am saying

Object of Java Script Foundation

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.