Create number_of_occurrences.js

the most common solution. some other ways: using reduce instead (or filter, but that may not scale as well)