title: Equivalent of Underscore _.pluck in pure JavaScript
body: <p>I'm trying to recreate the Underscore pluck function using pure JS.  However, I keep getting an array of undefineds being returned, instead of the actual values from the properties of the objects in an array.  </p>
  
  <p>Checking another thread <a href="https://stackoverflow.com/questions/9329114/equivalent-of-underscore-js-pluck-in-jquery%20&#39;here&#39;">here</a> I found that you could reproduce it in jQuery with the following code...</p>
  
  <pre><code>$.pluck = function(arr, key) { 
      return $.map(arr, function(e) { return e[key]; }) 
  }
  </code></pre>
  
  <p>...however I am having difficulty just reproducing this in pure JS.  I tried the following, however this is just returning an array of undefineds for me.  </p>
  
  <pre><code>var pluck = function(arr,key){
    var newArr = [];
    for (var i = 0, x = arr.length; i &lt; x; i++){
      if (arr[i].hasOwnProperty(key)){
        newArr.push(arr[i].key)
      }
    }
    return newArr;
  }
  </code></pre>
  
  <p>So, the goal would be the following, except instead of using the underscore _.pluck, just use a JS function name, eg. var pluck = function(arr,key){...}</p>
  
  <pre><code>var Tuts = [{name : 'NetTuts', niche : 'Web Development'}, {name : 'WPTuts', niche : 'WordPress'}, {name : 'PSDTuts', niche : 'PhotoShop'}, {name : 'AeTuts', niche : 'After Effects'}];
  var niches = _.pluck(Tuts, 'niche');
  
  console.log(niches);
  
  // ["Web Development", "WordPress", "PhotoShop", "After Effects"]
  </code></pre>
  
  <p>Could someone steer me in the right direction?</p>