defining a dynamic 2 dimensional array using prototype.slice.call
<p>I try to create a dynamic 2 dimensional array using the prototype.slice.call. The array dimension varies depending on the value k inserted by the user. The code is as follows:</p>

<pre><code>var A = new Array(k);

                if (k &gt; 1) {
                    var args = Array.prototype.slice.call(k, 1);
                    for (var n = 0; n &lt; k; n++) {
                        A[n] = new Array.apply(this, args);
                    }
                }



                alert (A);  
</code></pre>
