js操作数组
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.replace = function (oldValue, newValue) {
var index = this.indexOf(oldValue);
if (index > -1) {
this.splice(index, 1, newValue);
}
}
操作的数组元素可以是基本类型、也可以是引用类型,如:[{'payPrice':'660','CertificateNum':'36010419570720154X','Enterpriseid':'99','userId':'790734'},
{'payPrice':'660','CertificateNum':'362322198811080011','Enterpriseid':'99','userId':'790742'}]

浙公网安备 33010602011771号