javascript object array Group By and Get values : I want to do a groupBy for the below object array on deptId and I should be able to display the data on page using angular as below

I have an object like this

    var arr = [
         {deptId: '12345',deptName: 'Marketing', divId: '1231',divName: 'Lead'},
         {deptId: '12345',deptName: 'Marketing', divId: '8796',divName: 'Assistants'},
         {deptId: '32145',deptName: 'Sales', divId: '1231',divName: 'Lead'},
         {deptId: '32145',deptName: 'Sales', divId: '8796',divName: 'Assistants'},
         {deptId: '32145',deptName: 'Sales', divId: '8221',divName: 'Associates'}
    ]

Display on ui as below

Marketing
 <ul><li>Lead 
 <li>Assistants
</ul>
Sales
 <ul>
 <li>Lead
 <li> Assistants
 <li> Associates
</ul>