title: Underscore.js _.map function : skip a value
body: <p>I am trying to use underscore.js <code>_.map</code> function on an array of objects, to get an array with a property of each object. That's the usual scenario, so :</p>
  
  <pre><code>var finalArray = _.map(myArray, function(obj) {
      return obj.myProperty;
  });
  </code></pre>
  
  <p>But in some cases I need that <em>nothing</em> be added in the array. It could be something like :</p>
  
  <pre><code>var finalArray = _.map(myArray, function(obj) {
      if (!obj.ignore) {
          return obj.myProperty;
      }
  });
  </code></pre>
  
  <p>The result of this is that an <code>undefined</code> value is pushed into the array, which is not the same as not pushing anything at all.</p>
  
  <p>Is there a way for the map function not to push a value, or do I need to post-process my <code>finalArray</code> to remove the unwanted <code>undefined</code>'s?</p>