title: finding available combinations (permutations?) of two arrays
body: <p>Having a hard time googling for this since I'm not sure what the concepts are called, and all of the "combinations of two arrays/groups" SO posts are not giving me the output I would expect.</p>
  
  <p>Example arrays:</p>
  
  <pre><code>var array1 = ['Bob', 'Tina'];
  var array2 = [0, 100];
  </code></pre>
  
  <p>I can find possible combinations with nested looping through both arrays. But that would give me an output like:</p>
  
  <pre><code>var array1 = ['Bob', 'Tina'];
  var array2 = [0, 100];
  var options = []
  
  array1.forEach(function (name) {
    array2.forEach(function (number) {
      options.push([name, number])
    })
  })
  
  
  console.log(options);
  &gt; [ [ 'Bob', 0 ], [ 'Bob', 100 ], [ 'Tina', 0 ], [ 'Tina', 100 ] ]
  </code></pre>
  
  <p>this post (<a href="https://stackoverflow.com/questions/8822950/creating-combinations-in-javascript">Creating Combinations in JavaScript</a>) gives me the output above</p>
  
  <p>But what I'm really looking for would give me arrangements/combinations like this:</p>
  
  <pre><code>[
    [['Bob', 0], ['Tina', 0]],
    [['Bob', 0], ['Tina', 100]],
    [['Bob', 100], ['Tina', 0]],
    [['Bob', 100], ['Tina', 100]]
  ]
  </code></pre>
  
  <p>And it would need to be able to scale with longer arrays, but 2x2 is the easiest example.</p>
  
  <p>This cartesian example here (<a href="https://stackoverflow.com/questions/20478829/matrix-combinations-of-two-arrays-in-javascript">Matrix combinations of two arrays in javascript</a>) also gave me broken out strings and not correlated arrangements:</p>
  
  <pre><code>[ { '0': 'B', '1': 'o', '2': 'b' },
    { '0': 'B', '1': 'o', '2': 'b' },
    { '0': 'T', '1': 'i', '2': 'n', '3': 'a' },
    { '0': 'T', '1': 'i', '2': 'n', '3': 'a' } ]
  </code></pre>
  
  <p>I have been looking through google and SO but I'm hitting roadblocks because I'm not sure what I'm actually looking for.</p>