title: Comparing arrays and adding?
body: <p>I have two arrays</p>
  
  <pre><code>Data = [
  "year": 2001, "count": 35,
  "year": 2002, "count": 15,
  "year": 2005, "count": 2
  ]
  
  Years = [2000, 2001, 2002, 2003, 2004, 2005, 2006]
  </code></pre>
  
  <p>What I want to do is: check if the <code>Years</code> exist in the <code>Data</code>, and if they don't, add "year" to the <code>Data</code>, with a "count" of 0.</p>
  
  <p>All I can do so far is check that they're there.</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>Data = [
    "year": 2001, "count": 35,
    "year": 2002, "count": 15,
    "year": 2005, "count": 2
  ]
  
  Years = [2000, 2001, 2002, 2003, 2004, 2005, 2006]
  
  for (var i = 0; i &lt; Data.length; i++) {
    $(Years).each(function(value) {
      if (Data.indexOf(Years[value]) != -1) {
        console.log("missing one");
      };
    })
  }</code></pre>
  </div>
  </div>
  </p>