I need to count the number of record present inside array of objects as per key value using Javascript/Jquery. I am explaining my code below.
var arrResult = [{"name":"jim","amount":34,"date":"11/12/2015"},
{"name":"carl","amount":120.11,"date":"11/12/2015"},
{"name":"jim","amount":45,"date":"12/01/2015"},
{"name":"stacy","amount":12.00,"date":"01/04/2016"},
{"name":"stacy","amount":34.10,"date":"01/04/2016"},
{"name":"stacy","amount":44.80,"date":"01/05/2016"}
];
The above is my array of object. Here I need to count the no of record as per same name
value and my expected output is given below.
var output=[
{"name":"jim","count":2},
{"name":"carl","count":1},
{"name":"stacy","count":3}
]