[AS2] number of occurrences in an array

is there anyway to count the number of occurrences of an element in an array??

eg

array = (a, a, c, h, a, h, g, j, j, j)

//Number of times each element appears in the array
a=3
c=1
h=2
g=1
j=3