title: How to add a key value pair to an array in Javascript / Jquery
body: <p>I have 2 arrays as below </p>
  
  <pre><code>var dataSource = [
  {location: "France", January: 79, February: 81, March: 23},  
  {location: "Germany", January: 98, February: 83},
  {location: "Japan", January: 96, March: 11} ];
  
  var Months = ["January","February","March"];
  </code></pre>
  
  <p>I want to loop through each object in <code>dataSource</code> and check if all values of <code>Months</code> exist in each objects of <code>dataSource</code>. If the value doesn't exist in <code>dataSource</code> then add that value to <code>dataSource</code> with value = 100</p>
  
  <p>example : in location Germany, the month "March" does not exist so I need to push the key and value <code>March : 100</code></p>
  
  <p>at the end <code>dataSource</code> should be as below </p>
  
  <pre><code>var dataSource = [
  {location: "France", January: 79, February: 81, March: 23},  
  {location: "Germany", January: 98, February: 83, March: 100},
  {location: "Japan", January: 96, February: 100, March: 11} ];
  </code></pre>
  
  <p>I tried many solutions from previous threads but I am not getting the exact result I want. Here are some of my ideas</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var dataSource = [
  {location: "France", January: 79, February: 81, March: 23},  
  {location: "Germany", January: 98, February: 83},
  {location: "Japan", January: 96, March: 11} ];
  
  var Months = ["January","February","March"];
  
  dataSource.forEach(function(element) {
  Months.forEach(function(item) {
    if (!(item in element)) {
  //Object.assign(dataSource, {item: 100}); 
  //dataSource = {...dataSource, ...{item: 100}}
  dataSource.push({item: 100});
    }
  });
  });
  
  console.log(dataSource);</code></pre>
  </div>
  </div>
  </p>
  
  <p>Thank you for your suggestions.</p>