title: How to use underscore .groupBy function to group an array of json objects based on multiple properties?
body: <p>I have an array of json objects who results I want to <a href="http://underscorejs.org/#groupBy" rel="nofollow">groupBy()</a> based on multiple properties i.e.,</p>
  
  <p>I have:</p>
  
  <pre><code>[
    {
       prop1:val1,
       prop2:val2,
       prop3:val3,
       prop4:val4
    }
  ]
  </code></pre>
  
  <p>Now if I just wanted to group by <code>prop1</code> I guess I could have done :</p>
  
  <pre><code>_.groupBy(givenArray, 'prop1');
  </code></pre>
  
  <p>Now what should I do if I have to group by <code>prop1</code>,<code>prop2</code> and <code>prop3</code>, i.e., <code>(prop1 &amp;&amp; prop2 &amp;&amp; prop3)</code></p>
  
  <p>Please guide.</p>