title: Javascript Json : Sum values by matching json keys
body: <p>My input in one single json</p>
  
  <pre><code>input = [{
  
          "201609": 0,
          "201610": 0,
          "201611": 0,
          "201804": 130,
          "201805": 130,
          "fy16Q3": 17,
          "fy17Q1": 0,
          "fy17": 0,
          "fy17Q2": 0,
          "fy17Q3": 0
  
  }, {
  
          "201510": 0,
          "201610": 0,
          "201611": 10,
          "201803": 20,
          "201804": 30,
          "201805": 40,
          "201806": 130,
          "201809": 130,
          "fy17Q1": 2,
          "fy17": 3,
          "fy17Q2": 5,
          "fy17Q3": 6
  }];
  </code></pre>
  
  <p>In the output i want to iterate through all the elements of this json and sum the values of the matching keys. Also keep the non matching lone keys in the output as well.</p>
  
  <pre><code>output =
  [{
  
          "201510": 5,         // no matching pair
          "201609": 3,         // no matching pair
          "201610": 6+9 = 15,  // matching pair exist
          "201611": 10+12 = 22,
          "201803": 20,
          "201804": 30+13 = 33,
          "201805": 40+14 = 44,
          "201806": 130,
          "201809": 130,
          "fy16Q3": 17,           // no matching pair
          "fy17Q1": 2+7 = 9,      // matching pair exist
          "fy17": 3+8 = 11,
          "fy17Q2": 5+9 = 14,
          "fy17Q3": 6+100 = 106
  }];
  </code></pre>
  
  <p>The problem is that iam not able to figure out how to handle the keys which don't have a matching pair.</p>