title: How to sum the values of a JavaScript object?
body: <p>I'd like to sum the values of an object.</p>
  
  <p>I'm used to python where it would just be:</p>
  
  <pre><code>sample = { 'a': 1 , 'b': 2 , 'c':3 };
  summed =  sum(sample.itervalues())     
  </code></pre>
  
  <p>The following code works, but it's a lot of code:</p>
  
  <pre><code>function obj_values(object) {
    var results = [];
    for (var property in object)
      results.push(object[property]);
    return results;
  }
  
  function list_sum( list ){
    return list.reduce(function(previousValue, currentValue, index, array){
        return previousValue + currentValue;
    });
  }
  
  function object_values_sum( obj ){
    return list_sum(obj_values(obj));
  }
  
  var sample = { a: 1 , b: 2 , c:3 };
  var summed =  list_sum(obj_values(a));
  var summed =  object_values_sum(a)
  </code></pre>
  
  <p>Am i missing anything obvious, or is this just the way it is?</p>