JS移除数组数据,JS remove array

阅读更多
 /**
     * 移除身份证数组
     * @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);

 

你可能感兴趣的:(乔乐共享,js,remove,splice)