logo
logo

Count Occurrences

Count Occurrences

Write a function
countOccurrences(arr, val)
that takes an array of values and a value as inputs, and returns the number of times the value appears in the array. Use a for loop to iterate through the array.
Console
Submit
Solution
00:00