title: most efficient way to find average using lodash
body: <p>I have an array of objects, the number of objects is variable - </p>
  
  <pre><code>var people = [{
    name: john,
    job: manager,
    salary: 2000
  },
    {
    name: sam,
    job: manager,
    salary: 6000
  },
    {
    name: frodo,
    job: janitor
  }];
  </code></pre>
  
  <p>Whats the most elegant way to find the average of the salaries of all managers using lodash? ( I assume we have to check if an object is manager, as well as if the object has a salary property)</p>
  
  <p>I was thinking in the below lines - </p>
  
  <pre><code>_(people).filter(function(name) {
      return name.occupation === "manager" &amp;&amp; _(name).has("salary");}).pluck("salary").reduce(function(sum,num) { return sum+num });
  </code></pre>
  
  <p>But I am not sure if this is the right approach.</p>