I\'m trying to build a javascript function which would count the number of occurrences of each word in an input array.
Example :
Input
a=[\"a
function count(arr){ return arr.reduce(function(m,e){ m[e] = (+m[e]||0)+1; return m },{}); }
The idea behind are
reduce
m[e]
+m[e]
constructor
toString
Demonstration