Lodash allow you to do that pretty easily:
var sortedDept = _.groupBy(arr, function(ite){return ite.deptName});
Now you can access by sortedDept.Marketing –> give you an array with only marketing related object.
And just display those values.
2
solved JavaScript object array Group By and Get values