title: Why do I get a different output when using an if statement in filter as oppose to just return
body: <p>I am new to JavaScript and I am learning a little about High Order Functions. I was wondering if someone can tell me why:</p>
  
  <pre><code>function filter_list(arr) {
    return arr.filter(function(item) {
      return typeof(item) == 'number';   
    });
  }
  // input = [1,'a','b',0,15] output = [1,0,15]
  </code></pre>
  
  <p>But</p>
  
  <pre><code>function filter_list(l) {
    return l.filter(function(item){
      if (typeof item == "number") {
        return item;
      }
    });
  }
  // input = [1,'a','b',0,15] output = [1,15]
  </code></pre>
  
  <p>I am having a hard time seeing the difference.</p>