I have an array of n number of items
var arr1 = [2, 0, 0, 1, 1, 2, 0, 0, 0, 2, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, 2, 2, 1, 2, 2, 0, 1, 2, 2, 1, 1, 0, 1, 1, 0, 2, 1, 0, 0, 0, 2, 1, 1, 1, 2, 2, 1, 0, 0, 0, 2, 2, 2, 2, 2, 1, 0, 2, 2, 0, 2, 2, 0, 2, 0, 0, 1, 2, 1, 0, 2, 1, 0, 1, 2, 0, 2, 0, 0, 0, 1, 2, 1, 0, 2, 0, 0, 0, 1, 2, 1, 1, 1, 1]
as you see the array only has i different values (v)
(0,1,2),i = 3
in that case
What I would like is ending up with an array like this one.
var arr2 = [23, 45, 64]
the length of the arr2 array should corresponds to i and the values sould be the occurences of each value(v)
I am doing all kinds of loops and conditionals, but looking for a straight solution. my part so far http://jsfiddle.net/fiddlebjoern/aSsjy/2/
jQuery and/or underscore may be involved.