Définition de la fonction
Array.prototype.indexof = fonction (val) {for (var i = 0; i <this.length; i ++) {if (this [i] == val) return i; } return -1;}; array.prototype.remove = function (val) {var index = this.indexof (val); if (index> -1) {this.splice (index, 1); }}; Array.prototype.insert = fonction (index, item) {this.splice (index, 0, item);};utiliser:
MyArray.Remove (i); //Supprimer
//renouveler
MyArray.Remove (0);
MyArray.insert (0, eventJson [0]);
//insérer
MyArray.insert (0, eventJson [0]);
L'implémentation simple de l'ajout, de la suppression, de la modification et de la recherche JavaScript JavaScript JavaScript est tout le contenu que je partage avec vous. J'espère que vous pourrez vous faire référence et j'espère que vous pourrez soutenir Wulin.com plus.