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/