← Back to Loops
Question 36
forEach: Count Passing Scores
forEach: Count Passing Scores
Use forEach and an if statement to count how many scores are 60 or higher, then print the count. Array: [55, 78, 90, 62, 48] Steps: 1. Create a variable passingCount set to 0 2. Use forEach to check each score 3. If score is at least 60, increase passingCount 4. Print the final count
Expected Output:
Passing count: 3= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
LoopsArraysforEach
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (clog, fn, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.