title: Check each array value for NaN
body: <p>I have the following array:</p>
  
  <pre><code> var indexes = {
              'spear' : $('#commands_table th:has(img[src*="unit_spear"])').index(),
              'sword' : $('#commands_table th:has(img[src*="unit_sword"])').index(),
              'axe' : $('#commands_table th:has(img[src*="unit_axe"])').index(),
              'archer' : $('#commands_table th:has(img[src*="unit_archer"])').index(),
              'spy' : $('#commands_table th:has(img[src*="unit_spy"])').index(),
              'light' : $('#commands_table th:has(img[src*="unit_light"])').index(),
              'marcher' : $('#commands_table th:has(img[src*="unit_marcher"])').index(),
              'heavy' : $('#commands_table th:has(img[src*="unit_heavy"])').index(),
              'ram' : $('#commands_table th:has(img[src*="unit_ram"])').index(),
              'cata' : $('#commands_table th:has(img[src*="unit_catapult"])').index(),
              'noble' : $('#commands_table th:has(img[src*="unit_noble"])').index(),
              'knight' : $('#commands_table th:has(img[src*="unit_knight"])').index(),
  
              };
  </code></pre>
  
  <p>Sometimes it'll find a certain name, sometimes it won't. What I want to do is:</p>
  
  <pre><code>  var numberspear = $(this).closest('tr').children().eq(indexes[spear]).text();
  </code></pre>
  
  <p>Wich obviously won't work for a unit if it doens't exist. Now, i could obviously check every index seperatly, but that's not really efficient... Is there a way to check every value of my array and, if it doens't exist, remove it from the array? </p>
  
  <p>Thanks</p>