Ad
  • Custom User Avatar

    Comparison operators such as <= and > coerce their arguments to numbers, if necessary. ( If this is, indeed, JavaScript. )

    Coercion has some subtleties though, that's very probably what's biting you. If you're new to coding, it is probably better not to rely on coercion; there are other ways with fewer subtleties, that will inflict fewer bugs.

  • Custom User Avatar

    The argument s passed in is a string not a number, you need to test whether the string represents a single valid number.