JS 删除数组
//删除对象数组
function reomveLandList(landList,id){
var index=getLandListIndex(landList,id);
reomveByIndex(landList,index);
}
function getLandListIndex(landList,id){
for (var i = 0; i < landList.length; i++) {
if (landList[i].id == id) {
return i;
};
}
return -1;
}
function reomveByIndex(list,index){
list.splice(index, 1);
}
// 删除数组
function getIndex(leafletIdArr,id){
return leafletIdArr.indexOf(id);
}
function removeLeafletIdArr(leafletIdArr,id){
var index = getIndex(leafletIdArr,id);
leafletIdArr.splice(index, 1);
}