How to implement complex arrays? : <p>For example, when <code>id</code> is equal to 1, an array is <code>['a', 'b']</code>, and when <code>id</code> is equal to 2, another array is <code>['c']</code>. The result of these two arrays is <code>[["a","b "],["c"]]</code></p>

<p><strong>I want the results as follows:</strong></p>

<pre><code>[["a","b"],["c"]]
</code></pre>

<p><strong>my code:</strong></p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var data = [{
    id: 1,
    name: 'a'
  },
  {
    id: 1,
    name: 'b'
  },
  {
    id: 2,
    name: 'c'
  }
]</code></pre>
</div>
</div>
</p>
