Copy code code as follows:
/**
* Extended Startwith method
* @param Str
* @Return
*/
String.prototype.startWith = Function (STR) {
If (Str == NULL || Str == "" || This.Length == 0 || Str.Length> this.Length)
Return false;
If (this.substr (0, str.Length) == Str)
Return true;
else
Return false;
Return true;
};
/**
* Extend the contains method
* @param item
* @Return
*/
Array.prototype.contains = Function (item) {
Return regexp ("// b"+item+"// b"). Test (this);
};
/**
* IE does not support the INDEXOF method, adding indexof method to IE
*/
Array.prototype.indexof = Function (VAL) {
var value = this;
for (var I = 0; I <value.length; i ++) {
if (value [i] == Val) Return i;
}
Return -1;
};