title: How to get the sum of specific values in an array contained within another array
body: <p>I have an object with an array which contains another array. I need to add up the values from these child arrays where the name matches each other.</p>
  <pre><code>let arr = {
      expenses: [
          {
              id: 11,
              freqs: [
                  { name: &quot;day&quot;, value: 100 },
                  { name: &quot;week&quot;, value: 200 },
                  { name: &quot;month&quot;, value: 300 },
              ],
          },
          {
              id: 12,
              freqs: [
                  { name: &quot;day&quot;, value: 100 },
                  { name: &quot;week&quot;, value: 200 },
                  { name: &quot;month&quot;, value: 300 },
              ],
          },
          {
              id: 13,
              freqs: [
                  { name: &quot;day&quot;, value: 100 },
                  { name: &quot;week&quot;, value: 200 },
                  { name: &quot;month&quot;, value: 300 },
              ],
          },
      ],
  };
  </code></pre>
  <p>In this example, I would need the results:</p>
  <pre><code>let result = [
      { name: &quot;day&quot;, value: 300 },
      { name: &quot;week&quot;, value: 600 },
      { name: &quot;month&quot;, value: 900 },
  ];
  </code></pre>
  <p>I've been trying for ages with a combination of <code>filter()</code> and <code>reduce()</code> methods (unsure if these are the right way), but I just can't get it - it's really a headscratcher for me!
  Thank you</p>