Javascript: how to pass array-values as arguments to a function to be read using Function::arguments
<p>Pretty weird looking question, I admit. </p>

<p>I want to calculate the cartesian product of an array of arrays in javascript
The following function (from <a href="http://stackoverflow.com/questions/4796678/javascript-golf-cartesian-product">JavaScript Golf - Cartesian Product</a>)  does this for me: </p>

<pre><code>function cartesianProductOf() {
  return Array.prototype.reduce.call(arguments, function(a, b) {
    var ret = [];
    a.forEach(function(a) {
      b.forEach(function(b) {
        ret.push(a.concat([b]));
      });
    });
    return ret;
  }, [[]]);
}
</code></pre>

<p>However it needs to be called as such: 
<code>product([1, 2, 3], [4], [5, 6]); # =&gt; [[1, 4, 5], [1, 4, 6], [2, 4, 5], [2, 4, 6], [3, 4, 5], [3, 4, 6]]</code></p>

<p>but what I have is an array of arrays of which the dimensions are unknown, following the above example lets say: </p>

<p><code>var arrOfArr = [[1, 2, 3], [4], [5, 6]];</code></p>

<p>How would I pass the contents of <code>arrOfArr</code> (as in the individual arrays) as multiple parameters to function <code>Product</code> while I don't know the nr of arrays in <code>arrOfArr</code> beforehand? </p>

<p>i.e: product(arrOfArr) obviously doesn't work. </p>
