1. Create an Array object (with initial values assigned) in two ways:
Var aColor = new Array ('red', 'black', 'yellow ');
Alert (aColor. toString (); // output: red, black, yellow
Var aColor = ['red', 'black', 'blue'];
Alert (aColor. toString (); // output: red, black, blue
2. length: Get the length of the array.
3. toString (): all elements in the output array.
Alert (aColor. toString (); // output: red, black, yellow
4. valueOf (): Same as 3
5. join (): concatenate the array value and connect the array with a connector. The connected string is returned.
Eg. alert (aColor. join ("->"); // output: red-> black-> yellow
// (String) 6. split (): splits the string into character arrays, where split ("") splits the string into a single character array, for example. "str" is divided into s, t, r
7. contact (): attaches the parameter to the end of the Array. The returned function value is the new Array object.
Eg.
Var aColor = new Array ('red', 'black', 'yellow ');
Var aColorCon = aColor. concat ("1", "2 ");
Alert (aColorCon. toString (); // output: red, black, yellow, 1, 2
8. slice (): returns a new array with the specified item.
9. push ()/pop (): add an item to the end of the array. pop () deletes the last array item and returns the value.
Eg.
Var aColor = new Array ('red', 'black', 'yellow ');
AColor. push ("blue ");
AColor. push ("white ");
Alert (aColor. toString ());
AColor. pop ();
Alert (aColor. toString ());
10. shift (): Delete the first entry in the array.
11. unshift (): add the first item to the array, and move the other items backward.
Var aColor = new Array ('red', 'black', 'yellow ');
AColor. shift ();
Alert (aColor. toString ());
AColor. unshift ("red ");
Alert (aColor. toString ());
12. reverse (): reverse the order of array items.
13. sort (): sort array items in ascending order.
Eg.
Var aColor = new Array ('red', 'black', 'yellow ');
AColor. sort ();
Alert (aColor );
Alert (aColor. reverse ());
14. splice ().