title: JavaScript Array.filter not working as expected
body: <p>It seems correct for me, but it doesn't work:</p>
  
  <pre class="lang-js prettyprint-override"><code>var arr = [1, 2, 3, 4, 5];
  
  var bar = [2, 4];
  
  arr = arr.filter(function(v) {
    for (var i; i &lt; bar.length; i++) {
      return bar.indexOf(v);
    }
  });
  
  console.log(arr); // []
  
  // expected: [1, 3, 5]
  </code></pre>
  
  <p>How this will work, and how to do the same work with map?</p>