I have this array
var bmpArrayNames=["strip_cropping", "crop_rotation", "cover_crops", "filter_strips", "grassed_waterway", "conservation_tillage", "binary_wetlands"];
and this array
var bmpArray=["1", "1", "0", "0", "0", "0", "0"];
I need to loop through this bmpArray looking to see if the value =1. If it does, I want to replace the value with the value at the same index of the bmpArrayNames. Then I would remove all "0" ultimately ending with bmpArray=["strip_cropping,"crop_rotation"]
I started with this but am not stuck
$.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.
Thanks in advance!