C1 Receipt trace
8 minSuggested first: L06 Types and failure paths
Outcome
Trace a loop, a branch and a return by hand, without running the code.
The case
Three short items about one function. Each has one accepted answer and can be retried. After a miss, the review link names the lesson to revisit. Three out of three is a sign you're ready for the next group, not a gate: nothing is locked.
function receipt(prices) {
let total = 0;
for (const price of prices) {
if (price > 0) total += price;
}
return total >= 10 ? total - 2 : total;
}
const due = receipt([4, 0, 6]);
Checkpoint items
Review
After each group, do its checkpoint in one sitting and revisit one missed item the next day. Then try a puzzle in a repository you haven't read yet.