I have javascript array in which I need to return 3 values with highest occurrences. Lets say we have an array like this.
[1,3,4,5,2,3,4,5,6,7,8,5,4,5,3,5,6,7,3,5,6,5,6,3,4,5,6,6]
1 - 1 time 2 - 1 time 3 - 5 times 4 - 4 times 5 - 8 times 6 - 6 times 7 - 2 times 8 - 1 time
How can we return 3 values with most occurrences (in this case 4, 5 and 6) using jQuery.
Hope that makes sense.
Thanks in advance.