title: Javascript: add the value of all objects in each array
body: <p>obj orders has items that each contain a value.</p>
  
  <p>Example of orders structure:</p>
  
  <pre><code>   Array [0: Object { item: "shirt", status: "draft", "value":1 }] 
     Array [0: Object { item: "shirt", status: "failed", "value":0} 1: Object { item: "shirt" , status: "draft" ,"value":1}]
  </code></pre>
  
  <p>There can be multiple objects in each array, I will not know this.
  How can I add the value of all objects in each array? I will then divide by the length of each array.</p>
  
  <p>I have tried </p>
  
  <pre><code> var sum = 0;
    for(var i=0; i&lt; order.length; i++) {
        sum += order.value + order.value;
    }
  </code></pre>