Answers for "javascript count number of occurrences in array of objects"

-1

javascript count number of occurrences in array of objects

var result = array.reduce( (acc, o) => (acc[o.name] = (acc[o.name] || 0)+1, acc), {} );
Posted by: Guest on October-28-2020
-2

javascript count number of occurrences in array of objects

var array =
    [
        {"name":"abc","age":20}
        {"name":"abc","age":20}
        {"name":"abc","age":20}
        {"name":"xyz","age":21}
        {"name":"xyz","age":21}
    ]
Posted by: Guest on October-29-2020

Code answers related to "javascript count number of occurrences in array of objects"

Code answers related to "Javascript"

Browse Popular Code Answers by Language