Frequency Pulse
MediumAcc. 88.4%
+30 XP 12
Precise Occurrence
Counting frequencies is a key part of data analysis. Whether it is scores in a game or items in an inventory, the logic is the same.
The Assignment
Your function receives an array data and a target value.
- Use a loop to scan the entire array.
- Every time the current element matches the
targetexactly, increment acountvariable. - Print the final
count.
01EXAMPLE 1
Input
data=["apple", "banana", "apple"], target="apple"Output
2Explanation: "apple" appears twice.
Constraints
- Iterate through every element.
ArraysLoopsCounting
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
data["apple","banana","apple","orange","banana","apple"]
target"apple"
Expected Output
3
Click RUN to test your solution