title: Cartesian product of multiple arrays in JavaScript
body: <p>How would you implement the Cartesian product of multiple arrays in JavaScript?</p>
  
  <p>As an example,</p>
  
  <pre><code>cartesian([1, 2], [10, 20], [100, 200, 300]) 
  </code></pre>
  
  <p>should return</p>
  
  <pre><code>[
    [1, 10, 100],
    [1, 10, 200],
    [1, 10, 300],
    [2, 10, 100],
    [2, 10, 200]
    ...
  ]
  </code></pre>