1: Create an object (simple)
Var point = new Object ();
Point. x = 10;
Point. y = 10;
2: direct use of objects (objects can be initialized in json format)
Var point = {x: 2.3, y:-1.2}
Var rectangle = {upperLeft: {x: point. x, y: point. y },
LowerRight: {x: 100, y: 200}
};
3: null and undefined
Var x; (variable a has been declared, but the default value is undefined if no value is assigned)
Alert (u); (call undefined u variable, leading to null exception null)
4: basic type and reference type
The first thing to know is that numeric values, strings, null, and undefined belong to the basic type. Objects and arrays are reference types.
Differences between basic and reference types
Basic Type:
Var a = 3.14;
Var B =;
A = 4;
In the alert (B) pop-up 3.14, only the value of a is assigned to B. Changing the value of B is not affected.
Reference Type:
Var a = [1, 2, 3];
Var B =;
A [0] = 99;
Alert (B [0]) pops up 99. Here, the array address of a in the memory is referenced, which is similar to the pointer address in c.
Not yet to be continued (in the learning stage, if you have any mistakes, please point them out. Thank you)
From: I can't say goodbye