(1) array:
Method 1:
VaR avalue = new array (20 );
Method 2:
VaR avalue = new array ();
Avalue [0] = "";
Avalue [1] = "B ";
...
Method 3:
VaR avalue = new array ("A", "B ",...)
Method 4:
VaR avalue = ["A", "B",...] (the array class is not explicitly declared)
The avalue. Join (parameter) method connects the array items. The connector is a parameter.
Avalue = new array ("A", "B", "C ")
Avalue. Join ("-") // output: "a-B-c"
A reverse method is: String. Split (parameter. Convert string type to array
VaR scolor = "green ";
VaR acolor = scolor. Split (""); // obtain the array ["g", "r", "E", "E", "n"];
The Concat () and slice () Methods of the array class are the same as those of the string class.
The push (), pop (), unshift (), shift (), and method of the array class provide their similar stack (later, first, first, and foremost) and similar Queue (first-in-first-out lilo.
Array_name.reverse () Reverse the array order
Array_name.sort () sorts arrays.
Array_name.splice () inserts data items into the middle of the array (very useful and interesting .)
(2) Date:
Commonly used:
VaR _ date = new date ();
VaR _ year = _ date. getfullyear (); current year
VaR _ month = _ date. getmonth (); current month
VaR _ day = _ date. getdate (); current day
Alert (_ date. totimestring (). Split ("") [0]); current hour, minute, and second
(3) Global built-in objects
Special functions such as isnan () and parseint () are their functions.
The biggest difference between encodeuri (), encodeuricomponent (), decodeuri (), decodeuricomponet (), and escape () in the BOM method is that escape () non-ASCII character set symbols are not encoded. Therefore, encodeuri () is recommended for encoding.
(4) math built-in object
Min ()
Max ()
ABS () absolute value,
Ceil () rounded up
Floor () rounding down
Round () Rounding
Alert (math. Ceil (25.5); // output 26
Alert (math. Floor (25.5); // output 25
Alert (math. Round (25.5); // output 26
Random () returns a random number between 0 and 1.
For example, select a random number from 1 to 10:
VaR inum = math. Floor (math. Random () * 10 + 1)