You’ve built the shelf helper one function at a time, with tests checking each step. Now it’s time to write a whole program of your own. In this final project, you’ll pick a small brief, or another idea cut to the same size, and build it locally in a file you run with node.
Plan on two to three hours, spread over as many sittings as you like. Each sitting can end at a natural stopping point: the data typed in, one function working, the report printing, or your checks done. Your file keeps everything, so you can pick up where you left off.
There are no automated tests this time. Instead, you’ll decide what your program should print before you run it, and then compare the output with your prediction. That’s the same habit you used in the warm-up, and it’s how you’ll know your program works.
Choose Your Project
Every project in this brief has the same shape, which matches what you’ve practiced throughout this course:
- A small list of flat records, written directly in your file
- At least two named functions of your own, each with one job
- At least one loop over the records and at least one
ifthat makes a decision - A readable report printed to the terminal
You don’t need to read files, save data, generate random numbers, or build a web page. Those belong to later courses, and leaving them out keeps the project finishable in an evening or two.
Pick one of the three briefs below. Each gives you sample data, the exact rules, and an example of the report your program should print. Read the requirements carefully, because they determine every expected result, including what happens exactly at a limit and when nothing matches.
You can also bring your own idea, such as a reading list, a plant-watering schedule, or a weekly snack budget. Keep it to the same size: five to eight records with three to five fields each, one selection rule, one or two totals or counts, and one decision in the report. Write your requirements down in the same style as the briefs before you start coding.
If your idea feels too big or too vague, the mentor can help you trim it. Describe your idea in the chat, and the mentor asks a few questions about your data and the one question your program should answer, then suggests a version that fits the time.
Whichever project you choose, create a file such as scratch/game-night.js in your scratch folder and run it with node scratch/game-night.js from the terminal in your course folder.
Before you type any code, take ten minutes with pen and paper. List the functions you’ll write, what each one returns, and what it returns for an empty list. Then build one function at a time, and run your file after each one with a temporary console.log() call, so a mistake shows up while it’s still small.