Vs2008
This document describes the object type, string type, and array type.
Object Type
(1) GetType Method
Obtains the type of an object instance.
(2) gettypename Method
Obtains the type name of an object instance. Userlogic = Function () {
This. _ Username= "Guo";
}
Userlogic. Prototype = {
Get_username: function () {
Return This. _ Username;
}
} ;
Userlogic. registerclass ( " Userlogic " );
VaR u = New Userlogic ();
Alert (object. gettypename (U );
Alert (object. GetType (u ));
String type
(1) startswith Method
Determines whether the string starts...
(2) endswith Method
Judge whether the string ends...
(3) trim method
Removes spaces on both sides of the string.
(4) trimstart Method
Remove the space on the left of the string.
(5) trimend Method
Remove spaces on the right of the string
(6) format Method
Format a string
(7) localeformat Method
Format the string. The format of the date and number objects is based on the current cultrue VaR s = " Today is {0} " ;
Alert (string. Format (S, New Date ()));
Alert (string. localeformat (S, New Date ()));
Array type
Add Method
Add an item
Addrange Method
Add an array to the end
Clear Method
Remove all elements
Clone Method
Clone an array
Contains Method
Whether the specified item is included
Dequeue Method
Remove the first item from the beginning
Enqueue Method
Same as the Add Method
Foreach Method
Traverse the array and subscribe to an Array Processing Function
Indexof Method
Locate the element that matches the given item and return its index value
Insert Method
Insert an item in the array
Parse Method
Converts a string to an array. The string format must be: "['Item1', 'item2', 'item3']"
Remove Method
Removes the first element that matches the given item.
Removeat Method
Removes the element at the given index location.
Examples: VaR arr = [ " Gzj " , " Jww " ];
Array. Add (ARR, " Wen " );
Alert (ARR. Join ( " , " ));
Array. addrange (ARR ,[ " CC " , " Dd " , " CC " ]);
Alert (ARR. Join ( " , " ));
Array. Remove (ARR, " CC " );
Alert (ARR. Join ( " , " ));
Usage of the foreach method:VaR arr = [ " Gzj " , " Jww " ];
This . Prefix = " $ " ;
Array. foreach (ARR, addprefix, This );
Function addprefix (element, index, array) {< br> alert (element);
alert (INDEX );
alert (array. tostring ();
alert ( This . prefix);
}
VaR s= "['Item1', 'item2', 'item3']";
VaR arr=Array. parse (s );
Alert (ARR. Join ("|"));