我有这个数组
var bmpArrayNames=["strip_cropping", "crop_rotation", "cover_crops", "filter_strips", "grassed_waterway", "conservation_tillage", "binary_wetlands"];
和这个数组
var bmpArray=["1", "1", "0", "0", "0", "0", "0"];
我需要遍历这个 bmpArray 来查看值是否 =1。如果是这样,我想用 bmpArrayNames 的同一索引处的值替换该值。然后我会删除所有最终以 bmpArray=["strip_cropping,"crop_rotation"] 结尾的“0”
我从这个开始但没有被卡住
$.each(bmpArray, function(index, value) {
if (value=="1")
//so if i find a match how do I replace with the same indexed value in the other array.
提前致谢!