Defensive coding prevents crashes and weird states. Type a number and try edge cases like empty input, huge values, or letters.
Result
—
Status
Ready
Errors
0
Rule
Validate first
We’ll compute sqrt(value) safely. Invalid inputs are handled with clear messages.
What’s different from last game?
You move from debugging after-the-fact to preventing bad states up front.
Optional challenge variants
Tips
Open DevTools → Console to see helpful logs. Try changing constants at the top of the script.