Javascript

How would you go about coding a JavaScript function to tally the number of times an element appears in an array?

Did you come across this question in an interview?

Interview question asked to Frontend Engineers interviewing at Riot Games, NaturalMotion, Twitch and others: How would you go about coding a JavaScript function to tally the number of times an element appears in an array?.