Given data like
var data = [
{
"a" : "x"
... (other properties)
},
{
"a" : "x"
... (other properties)
},
{
"a" : "y"
... (other properties)
},
]
The count of the most common "a"-property value would be 2, (for "x").
Now, what would be the cleanest way to get this from data
?
I assume there might be a nice way to generate an array of the different counts, i.e. [ 2 , 1 ]
in this case, and then run Math.max(...array)
on this?
But I can't seem to find a clean way of doing this?