Answers for "lodash count duplicates in array"

0

lodash count duplicates in array

const data = ["apple", "banana", "apple", "orange", "grapes", "mango", "banana"];

const result = _.values(_.groupBy(data)).map(d => ({name: d[0], count: d.length}));

console.log(result);
Posted by: Guest on August-19-2021

Code answers related to "lodash count duplicates in array"

Browse Popular Code Answers by Language