Array transformation in JS : <p>I have array transformation required as below in JS.</p>

<p>Source Array</p>

<pre><code>var numbers =
[ 
[0,0,4],
[0,1,9],
[0,2,16] ,
[0,2,7] ,
[0,2,5] ,
[1,0,1],
[1,1,2],
[1,1,4],
[1,2,3] 
];
</code></pre>

<p>Here first value in the source array represents row of target array, second value represents column of target array.</p>

<p>So the expected result array looks like</p>

<pre><code>var result = [
[4, 9, [16, 7, 5]],
[1, [2, 4], 3]
];
</code></pre>

<p>Note: 
1.Source/Target array can contain N number of rows &amp; columns.</p>
