title: Sum Values of Object in a Array
body: <p>trying to sum my values from my Object in my Array</p>
  <p>I have 3 Objects and in every Object there are two fields where i have values declared:</p>
  <pre><code>let items = [
         {
          id: 1, 
          label: 'test', 
          itemname: 'testitem', 
          pieces: 4,
          weight: 0.02
        },
        {
          id: 2, 
          label: 'test', 
          itemname: 'testitem', 
          pieces: 4,
          weight: 0.02
        },
        {
          id: 2, 
          label: 'test', 
          itemname: 'testitem', 
          pieces: 4,
          weight: 0.02
        }
      ];
  </code></pre>
  <p>so if i am right the weight sum would be 0.06 and the sum of the pieces would be 12, both multiplied that would be 0.72, that means i want to multiply the sum of the weight with the sum of the pieces.</p>
  <p>i saw examples like this:</p>
  <pre><code>const weight = items.reduce((prev, cur) =&gt; {
    return prev + (cur.weight * cur.pieces);
  }, 0);
  console.log(weight);
  </code></pre>
  <p>with this example the total sum would be only 0.24.
  Could someone help me here out</p>
  <p>Edit: @Robby Cornelissen was right with his comment. It was a wrong way of thinking on my part.</p>