Ad
  • Custom User Avatar

    I feel like you're splitting hairs. NaN, literally not a number, is of type number because there is no other primal it could be attached to. Would it be attached to a string? Array? Boolean?

    From the ECMA 2015 specfications it says that NaN is "number value that is an IEEE 754-2008 'Not-a-Number' value." What about positive and negative infinity? Those are also "number" values that don't directly relate to a number but are under the number primals.

    You should either specify that non-numerical number types should be accounted for or admit that your test case was ill-concieved and that it's illogical to try and add NaN, infinity, or -infinity.

  • Custom User Avatar

    According to javascript NaN is a number so... even If I don't like it too the sum of number NaN plus number 2 is NaN. Yes ironically the constant for Not A Number is of type.... number!!!.

    typeof NaN === "number" //true