title: Idiomatically find the number of occurrences a given value has in an array
body: <p>I have an array with repeating values. I would like to find the number of occurrences for any given value. </p>
  
  <p>For example, if I have an array defined as so: <code>var dataset = [2,2,4,2,6,4,7,8];</code>, I want to find the number of occurrences of a certain value in the array. That is, the program should show that if I have 3 occurrences of the value <code>2</code>, 1 occurrence of the value <code>6</code>, and so on.</p>
  
  <p>What's the most idiomatic/elegant way to do this?</p>