Function definition
Array.prototype.indexOf = function(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 = function (index, item) { this.splice(index, 0, item);};use:
myarray.remove(i); //Delete
//renew
myarray.remove(0);
myarray.insert(0,eventjson[0]);
//insert
myarray.insert(0,eventjson[0]);
The simple implementation of the above javascript js operation array addition, deletion, modification and search is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.