Loading lesson…
Level 1 · Apprentice0 XP
A function should do what its name says, and nothing hidden.
Step 1 / 5
ProblemA function called checkPassword() returns true or false. Hidden inside, it also resets the session. Someone calls it to show a hint on the login form, and users get logged out. The name lied.
← → step
Before this: Function parameters
🛠️ Your turn
Reading is not the skill, doing is. Try for ten minutes before you open the hint. Getting stuck first is what makes the solution stick.
1.Take a function that calculates and saves in one go. Split it into a pure function that calculates and a thin function that loads, calls it and saves. Write a test for the pure part with no mocks.