title: How do I assign my .reduce function output to a variable?
body: <p>Given an object and a key, <code>getElementsThatEqual10AtProperty</code> returns an array containing all the elements of the array located at the given key that are equal to ten.</p>
  
  <p>I want to assign what my <code>.reduce</code> method outputs to a variable then use that variable inside my <code>if</code> statement. My code evaluates to <code>NaN</code>.</p>
  
  <pre><code>function getElementsThatEqual10AtProperty(obj, key) {
    var arrayTotal = 0;
    obj[key].reduce(function(a,b){
      arrayTotal = a + b;
     });
    if(arrayTotal === 10) {
      return obj[key];
    }
  };
  </code></pre>