Your 20-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 practice choosing the tools yourself.
Acceptance cases before you code
Before you write code, decide what each case below should print. Then work through them by changing the input variables at the top and pressing Run again. A padded name and a changed session count should catch different 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 |
| One session and no breaks | Study and elapsed minutes match; labels use the recalculated number |
When everything prints correctly, break one line on purpose (for example, add the breaks to study time too) and see which case shows the mistake. Put it back, then say in one sentence which rule the mistake broke. If you cannot remember how to do a step, revisit that 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.