JavaScript Learning-Customizing objects/

Source: Internet
Author: User

   JavaScript learning

  

"Custom Object"1, Basic concept ① object concept: An object is a collection of unordered attributes and methods; The data in the ② object is in the form of key-value pairs, with key values; ③ properties: A series of variables that describe the characteristics of an object. "Variables in objects"; ④ method: A series of methods that describe the behavior of an object. "Function in Object"; 2, Object declaration: ① literal declaration: Var ovj={key1:value1,//attribute Key2:value2func:function () {}//method}② the key in the object, can be any data type. However, it is generally used as a common variable name (no double quotes required), and the value in the ③ object can be any data type. However, the words of the string must be "" wrapped; ④ multiple sets of key-value pairs are separated by commas, the keys and values of the key-value pairs are separated by colons; 3. The read-write ① of the properties and methods in the object. Element character: Object inside: this. Property name this. Method name () object name. >>> object, write the variable name directly, and the default is to call the global variable. If you want to invoke the properties of your own, you need to use the This keyword ② through ["Key"] Call: Object name ["Property name"] Object name ["Method name"] () >>> If the key contains special characters, it is not available ① method, you must use the ② type; >> > object, write the variable name directly, and the default is to call the global variable. If you want to invoke the properties of the pair, you need to delete the object's properties/methods through the This keyword ③: Delete object name. Property Name/Method name

JavaScript Learning-Customizing objects/

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.