title: how can I filter an array without losing the index?
body: <p>I have two really long arrays containing "picture names" and "picture files". The first one represents the actual name of the pictures, while the second one is just the file name. For example:</p>
  
  <pre><code>picturenames[0] = '0 - zero';
  picturenames[1] = '1 - one';
  picturenames[2] = '1 o\'clock';
  ...
  picturefiles[0] = 'numbers-zero.jpg';
  picturefiles[1] = 'numbers-one.jpg';
  picturefiles[2] = 'time-1.jpg';
  ...
  </code></pre>
  
  <p>I have about 1000 items in each array in several languages (the picture files are always the same). I'm "recycling" these arrays from the previous application to save some time and avoid rewriting everything anew.</p>
  
  <p><strong>Desirable functionality</strong>: using the user's input in a textbox I want to filter the <code>picturenames</code> array and then show the correspondant <code>picturefiles</code> image.</p>
  
  <p><strong>The issue I'm facing</strong>: when I filter the <code>picturenames</code> array I lose the index and I can't "reach" the picture file name.</p>
  
  <p>This is the code I'm using to filter the <code>picturenames</code> array.</p>
  
  <pre><code>var matches = picturenames.filter(function(windowValue){
      if(windowValue) {
          return windowValue.indexOf(textToFindLower) &gt;= 0;
      }
  });
  </code></pre>
  
  <p>What would be the best way to do this?</p>
  
  <p><strong>UPDATE</strong>: the solution proposed by Ahmed is the best one, but for time reasons and negligible performance issues I'm just using a for loop to search trough the array, as follows:</p>
  
  <pre><code>        var matchesCounter = new Array();
  
          for (i = 0; i &lt; picturenames.length; i++) {
              if (picturenames[i].indexOf(textToFindLower) &gt;= 0) {
                  matchesCounter.push(i);
              }
          }
  
          console.log(matchesCounter);
  
          for (i = 0; i &lt; matchesCounter.length; i++) {
              console.log(picturenames[i]);
              console.log(picturefiles[i]);
          }
  </code></pre>