Skip to content

Object.isNumber returns true on NaN #336

Open

Description

@BlueEyedRhino

Which is extremely funny if you think about it. Interesting it hasn't been noticed until now, but its rather rare situation I suppose. And this project is dead. Unfortunately.

Object.isNumber(NaN)
true

Activity

  1. ta2edchimp commented on Oct 12, 2017

    @ta2edchimp

    Well, NaN is the value of a variable of type Number, that is "not a number".
    It's not that it hasn't been noticed until now (see StackOverflow) — it's according to the specs (JS type Number is an IEEE 754 float.

    Think, for example, of parseInt(input) as a function with a return value of type Number and with an input value that cannot be parsed as a numeric value.
    The return value must be of type Number, but does not need to be of a numeric value, thus NaN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions