5 hands-on exercises and 5 find-the-bug challenges for the JavaScript throw lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Refuse a negative age and report the message.
Show that nothing after the throw runs.
Throw when dividing by zero and report the message.
A missing user is normal, so return null instead.
Catch an error and throw a clearer one.
A thrown string has no message property.
Error must be created with new to be thrown properly.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspaceReturning a message lets the caller ignore the problem.
A missing user is expected, so it should not throw.
Without a check the text is coerced and a wrong answer comes back.