Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Expecting inconsistent data types as a return value is not a best practice.
There is a perfectly good
Number
to return for invalid input:NaN
.Also, the description doesn't mention input validation at all, it's a task separate from doing maths, and it's not necessarily simple (or at least as simple as doing the math).