Throwing an Error and Testing It
Learn how to test when an error is expected.
Good programming practice must pro-actively consider bad function inputs and handle them within the function.
Throwing an error
We’ve thought briefly about strings, negative numbers, and fractions as inputs into getCollatzSequence
. What about array inputs or objects? The easiest solution is to throw an error if ...
Access this course and 1400+ top-rated courses and projects.