Club Score Statistics
JavaScript
20 pts
Club Score Statistics
The maths club needs statistics. Write four arrow functions that take an array of scores (no for loops):
passCount(scores)— how many scores are 50 or more (filter+length).average(scores)— the sum (reduce) divided by the number of scores.allPassed(scores)—trueif every score is 50 or more (every).anyPerfect(scores)—trueif at least one score is 100 (some).
The starter prints:
Passed: 4 of 5 Average: 70 Everyone passed: false Perfect score: true
Checklist
- Write
passCountandaverage. - Write
allPassedandanyPerfect. - Use
filter,reduce,everyandsome(no loops). - The four lines are printed.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
