Group by operation using one of arrays' values : <p>I have array of arrays in <code>javascript</code> that looks like: <code>[[1, 23.34, -5.22], [1, 2.34, -52.22], [2, 0.34, -5.02], ...]</code>. I need to <code>group by</code> by the first number in the arrays and produce 2 different ouputs:</p>

<ol>
<li><p>Object (<code>key: 2D array</code>) that looks like this: </p>

<pre><code>{1: [[23.34, -5.22], [2.34, -52.22]],
 2: [[0.34, -5.02], ...],
 ...} 
</code></pre></li>
<li><p>3D array that would just signify the grouping: </p>

<pre><code>[[[23.34, -5.22], [2.34, -52.22]], [[0.34, -5.02], ...], ...]
</code></pre></li>
</ol>

<p>I want to use <code>ES6</code>. Any suggestions would be greatly appreciated.</p>
