mardi 14 avril 2015

Count occurrences of array elements with JavaScript


Vote count:

0




I have this JavaScript array with length 129.



var fullnames = [Karri, Ismo, Grigori, Ahmed, Roope, Arto .....]


I would like to find how many times those names appeared in an array and store that information in an array like this:



var counter = [2, 5, 7, ..]


where Karri occured in fullnames array 2 times, Ismo occured 5 times etc. Any ideas about how to do it?



asked 34 secs ago







Count occurrences of array elements with JavaScript

Aucun commentaire:

Enregistrer un commentaire