title: if statement in jQuery each. loop of array
body: <p>I have this array</p>
  
  <pre><code>var bmpArrayNames=["strip_cropping", "crop_rotation", "cover_crops", "filter_strips", "grassed_waterway", "conservation_tillage", "binary_wetlands"];
  </code></pre>
  
  <p>and this array</p>
  
  <pre><code>var bmpArray=["1", "1", "0", "0", "0", "0", "0"];
  </code></pre>
  
  <p>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"]</p>
  
  <p>I started with this but am not stuck</p>
  
  <pre><code>$.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.
  </code></pre>
  
  <p>Thanks in advance!</p>