This chapter contains the object type, date type, regexp type, function type, basic wrapper type, and monomer built-in object.
A value (object) of a reference type is an instance of a reference type, which is a data structure. var person = new Object (); The new operator instantiates an object, and the instantiated object defines the default properties and methods.
5.1 Object Type
There are two ways to create an OBJECR instance. The first uses the New+object constructor:
var person = new Object;
Person.name = "Nicholas";
person.age = 29;
Another way is to use the object literal:
var person={
Name:nicholas,
Age:29
};
Use commas to separate different attributes, not commas after the last property
5.2 Array Type
There are two types of array creation
var arr = new Array ();
var arr=[];
The last index of an array is always length-1
The array length property is not read-only, you can add a new item to the array or remove an item from the end of the array by setting this property
5.2.1 Detecting arrays
The instanceof operator can only act on a global execution environment, with Arry.isarray () when a page contains multiple frames
5.2.2 Conversion method
Array inheritance tolocalestring (), toString (), valueof () methods
The Join method reproduces ToString (), separates the different delimiters, and returns the array as a string.
var num = [1, 2, 3];
Alert (num.join (' | ')); Output 1|2|3
5.2.3 Stack method
An array can be like a stack, which is a data structure that can restrict the insertion and deletion of items. Maintain the principle of LIFO.
The insertion or removal of an array is only found at the top of the stack.
A) push () is added to the end of the array
b) Pop () removes the last item from the end of the array and then returns the removed item
5.2.4 Queue method
5th Chapter Reference Types