JS移除数组数据,JS remove array
程序员文章站
2022-07-12 21:47:52
...
/** * 移除身份证数组 * @return void */ removeAIdCardFunc : function(idCard){ var idCardNos = _PAGE.idCardNos; for(var i = 0; i < idCardNos.length; i++){ if(idCard == idCardNos[i]){ _PAGE.idCardNos.splice(i, 1); break; } } }, /** * 移除乘客数组 * @return void */ removeAPassengerInfoFunc : function(idCard){ var passengerInfoArray = _STAGE.passengerInfoArray; for(var i = 0; i < passengerInfoArray.length; i++){ if(idCard == passengerInfoArray[i].cardNo){ _STAGE.passengerInfoArray.splice(i, 1); break; } } },
var index = array.indexOf(item); array.splice(index, 1);