Ad
  • Custom User Avatar

    Returning inconsistent datatypes is not good programming.

    I would suggest expecting an Error (e.g. a RangeError) to be thrown if the input is an invalid number. Or maybe expecting -1 to be returned.

    false even has the same truthiness as the correct return value for the valid input 6174. :[