Command Palette

Search for a command to run...

Hectal
Phase 5: Arrays
JavaScript · Exercise 3 of 6 PreviousNext
Beginner

Class report with filter, sort and reduce

Write report(students), where students is an array of { name, score } objects. Return an object with two properties:

passed: the names of students who scored 40 or more, sorted A to Z.

average: the average score of all students, rounded to a whole number with Math.round. For an empty array, the average is 0.

Don't change or reorder the students array.

What Check tests

  1. passed lists the names with 40 or more, A to Z
  2. A score of exactly 40 passes
  3. average is the rounded average of all scores
  4. An empty class gives no names and an average of 0
  5. The students array is not reordered

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.