title: Make an array of objects "complete" based on the contents of other arrays
body: <p>I have 3 arrays:</p>
  
  <pre><code>var countries = ['Montenegro', 'Spain', 'Belgium']
  var years = ['2000', '2001', '2002', '2003'];
  var death = ['cancer', 'measles'];
  </code></pre>
  
  <p>and an array of objects:</p>
  
  <pre><code>var values = [
      {country:'Montenegro', year:'2000', death:'cancer', number:'50'},
      {country:'Montenegro', year:'2001', death:'cancer', number:'60'},
      {country:'Montenegro', year:'2002', death:'cancer', number:'70'},
      {country:'Montenegro', year:'2003', death:'cancer', number:'80'},
      {country:'Spain', year:'2000', death:'cancer', number:'NaN'},
      {country:'Spain', year:'2001', death:'cancer', number:'110'},
      {country:'Spain', year:'2002', death:'cancer', number:'120'},
      {country:'Spain', year:'2003', death:'cancer', number:'130'},
      {country:'Belgium', year:'2000', death:'cancer', number:'70'},
      {country:'Belgium', year:'2001', death:'cancer', number:'80'},
      {country:'Belgium', year:'2002', death:'cancer', number:'90.5'},
      {country:'Montenegro', year:'2000', death:'measles', number:''},
      {country:'Montenegro', year:'2001', death:'measles', number:'1'},
      {country:'Montenegro', year:'2002', death:'measles', number:'2'},
      {country:'Montenegro', year:'2003', death:'measles', number:'3'},
      {country:'Spain', year:'2000', death:'measles', number:'2'},
      {country:'Spain', year:'2001', death:'measles', number:'3'},
      {country:'Spain', year:'2002', death:'measles', number:'NaN'},
      {country:'Spain', year:'2003', death:'measles', number:'5'}
  ];
  </code></pre>
  
  <p>What I would like is an array of objects that is "complete", that contains all the possible combinations of values present in the three arrays.</p>
  
  <p><code>values</code>, infact, doesn't contain objects related to:</p>
  
  <pre><code>{country:'Belgium', year:'2003', death:'cancer', ...},
  {country:'Belgium', year:'2000', death:'measles', ...},
  {country:'Belgium', year:'2001', death:'measles', ...},
  {country:'Belgium', year:'2002', death:'measles', ...},
  {country:'Belgium', year:'2003', death:'measles', ...}
  </code></pre>
  
  <p>So I would like to get this new object (the missing data is set to <code>NaN</code>):</p>
  
  <pre><code>var valuesComplete = [
      {country:'Montenegro', year:'2000', death:'cancer', number:'50'},
      {country:'Montenegro', year:'2001', death:'cancer', number:'60'},
      {country:'Montenegro', year:'2002', death:'cancer', number:'70'},
      {country:'Montenegro', year:'2003', death:'cancer', number:'80'},
      {country:'Spain', year:'2000', death:'cancer', number:'NaN'},
      {country:'Spain', year:'2001', death:'cancer', number:'110'},
      {country:'Spain', year:'2002', death:'cancer', number:'120'},
      {country:'Spain', year:'2003', death:'cancer', number:'130'},
      {country:'Belgium', year:'2000', death:'cancer', number:'70'},
      {country:'Belgium', year:'2001', death:'cancer', number:'80'},
      {country:'Belgium', year:'2002', death:'cancer', number:'90.5'},
      {country:'Belgium', year:'2003', death:'cancer', number:NaN}, // &lt;--
      {country:'Montenegro', year:'2000', death:'measles', number:''},
      {country:'Montenegro', year:'2001', death:'measles', number:'1'},
      {country:'Montenegro', year:'2002', death:'measles', number:'2'},
      {country:'Montenegro', year:'2003', death:'measles', number:'3'},
      {country:'Spain', year:'2000', death:'measles', number:'2'},
      {country:'Spain', year:'2001', death:'measles', number:'3'},
      {country:'Spain', year:'2002', death:'measles', number:'NaN'},
      {country:'Spain', year:'2003', death:'measles', number:'5'},
      {country:'Belgium', year:'2000', death:'measles', number:NaN}, // &lt;--
      {country:'Belgium', year:'2001', death:'measles', number:NaN}, // &lt;--
      {country:'Belgium', year:'2002', death:'measles', number:NaN}, // &lt;--
      {country:'Belgium', year:'2003', death:'measles', number:NaN} // &lt;--
  ];
  </code></pre>
  
  <p>The new array contains 24 elements = <code>countries.length * years.length * death.length</code>.</p>
  
  <p>What is the best way to do it?</p>