Ad
  • Custom User Avatar

    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).