Sign In
Count Occurrences
Beginner
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.
Click to go back
Click to go forward
Refresh preview
Console
Submit
Solution
00:00
Back to Exercises