Your 15-minute checkpoint
Close the earlier examples. Spend two minutes writing the inputs, expected outputs, and steps in plain language. Use about eight minutes to build and test, then five to explain your choices and try the variation. Taking longer is normal: these are study budgets, not speed tests.
Combine named values, arithmetic, and text formatting. This problem deliberately changes the setting so you practise choosing the tools yourself.
A small warm-up
Before the main task, predict this familiar idea from today’s work. If it is unclear, revisit the relevant teaching lesson first.
Check the foundation
Say why each line appears, not just what it prints.
const minutes = 2 * 15;
console.log(`Time: ${minutes}`);Check your prediction
Time: 30Use this only as a warm-up. The main task needs you to combine several decisions.
Acceptance cases before you code
Write a small test plan before implementing cleaned name and numeric totals. These cases extend the brief; they are not a second worked solution. Predict the expected behavior independently, then test through the public function. A good ordinary example and a good boundary example should catch different possible mistakes.
| Case to try | What your result should demonstrate |
|---|---|
| Padded name | Trim surrounding spaces without changing the original input |
| One session instead of three | Recalculate study and elapsed time from variables |
| Zero breaks | Elapsed time equals study time, with no invented extra break |
After the core task passes, deliberately break one rule and identify the case that notices it. Restore the implementation and explain the failure in terms of the contract, not the number of assertions. If a case requires a concept you have not recalled, revisit the relevant lesson before opening the solution.
A study-session receipt
A learner finishes three 20-minute sessions with two 5-minute breaks. Print their cleaned name, study time, and total elapsed time. Keep calculations numeric until you build the labels.
const nameInput = " Maya ";
const sessions = 3;
const sessionMinutes = 20;
const breaks = 2;
const breakMinutes = 5;Hint 1: the idea
Work out study time and elapsed time separately.
Hint 2: a first step
Multiply counts by their durations; add break time only to elapsed time.
Show one solution
const nameInput = " Maya ";
const sessions = 3;
const sessionMinutes = 20;
const breaks = 2;
const breakMinutes = 5;
const study = sessions * sessionMinutes;
const elapsed = study + breaks * breakMinutes;
console.log(`Learner: ${nameInput.trim()}`);
console.log(`Study: ${study} minutes`);
console.log(`Elapsed: ${elapsed} minutes`);Learner: Maya
Study: 60 minutes
Elapsed: 70 minutesTry one session and zero breaks. The two totals should then match. Change the name without changing any calculations.
Change the requirements
Try one session and zero breaks. The two totals should then match. Change the name without changing any calculations.
Decide what to revisit
- Can you explain what each variable stores and why the calculation uses it?
- Did you check an empty, boundary, or changed input rather than only the supplied one?
- Can you rebuild the essential part after closing the solution?
If you needed a hint, record the specific missing idea and revisit that lesson. Marking a page done records progress; it does not replace practice. Begin tomorrow by rebuilding one small part from memory.
Completion is saved in this browser only. It does not measure mastery.