Skip to main content

Practice · 3 of 3

Injection Seam

CHALLENGE
Difficulty: intermediate+25 XP

Write makeGreeter(clock) — clock is () => integer hour (0–23). Returns greet(name): before 12 => "Good morning, NAME", 12–17 => "Good afternoon, NAME", otherwise "Good evening, NAME". The point: behavior depends on time, so time MUST arrive by injection — greet must produce all three outcomes with a controlled clock.

Back to lesson: Practice: Seams & Doubles — Practice