Project brief
Build a todo filter and an average calculator. Both projects are small functional-programming workouts using higher-order functions and closures.
This is a workbook project in the JavaScript track. It has no single prescribed solution: build it in your own file, test it in the browser or Node, and compare your result with the checklist below.
What you will practise
- Higher-order functions
- Closure
Build it step by step
- Create a list of todo objects with a title and a completed flag.
- Write filters for all, active and completed items without changing the source array.
- Create a closure-based counter that tracks how many times a calculation is performed.
- Use
reduceto compute the average of a numeric list, returningnullfor an empty list. - Print the filtered lists and the average with clear labels.
Stretch goal
Add one feature that is not in the list above, then write down why you chose it and what you had to change. Keep the feature small enough to finish in one sitting.
Before you move on
- The project runs without errors in a fresh browser tab or Node process.
- Empty, missing and invalid inputs are handled deliberately.
- The code is split into small functions with clear names.
- You can explain every line you wrote.
Topics: Higher-order functions, Closure.