Copier le code du code comme suit:
/ **
* Méthode startwith étendue
* @param str
* @Retour
* /
String.prototype.startwith = fonction (str) {
If (str == null || str == "" || this.length == 0 || str.length> this.length)
Retourne false;
If (this.substr (0, str.length) == str)
Retour Vrai;
autre
Retourne false;
Retour Vrai;
};
/ **
* Étendez la méthode contient
* Article @param
* @Retour
* /
Array.prototype.contains = fonction (item) {
Return regexp ("// b" + item + "// b").
};
/ **
* IE ne prend pas en charge la méthode indexof, ajoutant une méthode d'index à IE
* /
Array.prototype.indexof = fonction (val) {
Var Value = This;
pour (var i = 0; i <value.length; i ++) {
if (valeur [i] == val) return i;
}
Retour -1;
};