The JavaScript method concludes:
One, Array ():
1, Shift (): Deletes the first element, returning the deleted value.
Example:
<script>
Function B (a) {
document.write (A + "<br/>");
}
var a = [8,2,3,4,5];
var shift = A.shift ();
B (Shift);
B (A.length);
}
</script>
2. Pop (): Deletes the last element, returning the deleted value.
3. Unshift (parameter): Loads the parameter to the front of the array and returns the length of the array.
4. Push (parameter): Loads the parameter to the end of the array and returns the length of the array.
5, concat (parameter): two or three arrays make up a new array.
6, Splice (0 (starting index value), 2 (number of deletions), text (the array to be inserted): Removes/inserts one or more elements from an array.
7, reverse (): Reverse the array.
8, Slice (0 (starting from [0]), 2 (2)): Returns a segment of an array
TwoDate ():
var now = new Date (); Create Date Object
1, getFullYear (); year
2, GetMonth (); month
3, GetDay ();
4, getHours ();
5, getminutes ();
6, getseconds (); seconds
ThreeMath ():
Ceil (); Take up the floor (); Take down the whole
Round (); rounding random ();
FourString ():
1, charCodeAt (index); Returns the Unicode encoding for the specified index
2, CharAt (index): Returns the character at the specified index position
3, Slice (0,2): Returns the fragment in the string (AB)
4, SubString (1,3): Returns a string of the specified length starting at the specified position (BC)
5, IndexOf ("A", 1 (starting from the 1th position)): When not found, returns a-1, when found, returns the position relative to the starting position.
6, LastIndexOf ("A", 7 (starting from the 7th position reverse)): Reverse Lookup
7, concat (): Connection string
Five, other packaging methods:
1, encodeURI (URL) decodeuri ("") (for text encoding decoding)
2, encodeURI comporent (URL) decodeuri comporent (URL) (for "/" "?" codec)
3, commonly used: eval (parameters) dynamic operation parameters.
Example: var str = "alert (123)";
eval (str);
Function: Pop-up window display 123;
How to summarize and use JavaScript