Foundation project
Project: a learning progress report
Lesson 12 of 20 · 18 min · Module 4: Reliable features
Bring together functions, conditions, arrays, and objects to build the logic behind a learning dashboard.
Start this lesson →Free. No installation: you write and run the code in your browser, and it is checked automatically.
By the end, you’ll be able to…
- Break a feature into testable steps
- Combine filter, map, and reduce
- Return a stable result shape for edge cases
The idea
Each lesson has a title, minutes, and completed flag. Your report should describe completed work while leaving the original records intact.
const lessons = [
{title: "Variables", minutes: 8, completed: true},
{title: "Loops", minutes: 9, completed: false}
];
01Start with the contract
The output always has the same three fields. Decide what each means before choosing methods. Count and minutes are numbers; titles is an array of strings.
02Build and check one part at a time
Start with one completed lesson. Add an unfinished lesson and confirm the report does not change. Add another completed lesson, then try an empty list. These checks expose different mistakes.
Your project brief
reportProgress(lessons) to return {completed, minutes, titles}: the number of completed lessons, their combined minutes, and their titles in input order. Empty input returns {completed: 0, minutes: 0, titles: []}.What the checks look for
- Counts only completed lessons
- Adds completed minutes and preserves title order
- Handles an empty list
- Does not mutate frozen records
Take this with you
A complete feature handles typical data, empty data, and the promise it makes about the input.