title: Removing elements with Array.map in JavaScript
body: <p>I would like to filter an array of items by using the <code>map()</code> function. Here is a code snippet:</p>
  
  <pre><code>var filteredItems = items.map(function(item)
  {
      if( ...some condition... )
      {
          return item;
      }
  });
  </code></pre>
  
  <p>The problem is that filtered out items still uses space in the array and I would like to completely wipe them out.</p>
  
  <p>Any idea?</p>
  
  <p>EDIT: Thanks, I forgot about <code>filter()</code>, what I wanted is actually a <code>filter()</code> then a <code>map()</code>.</p>
  
  <p>EDIT2: Thanks for pointing that <code>map()</code> and <code>filter()</code> are not implemented in all browsers, although my specific code was not intended to run in a browser.</p>