Home  >  Q&A  >  body text

javascript - Why isNaN(123) test result is false, is the input value not a number?

isNaN(123);//false
isNaN('123');//false
为情所困为情所困2687 days ago1114

reply all(3)I'll reply

  • 仅有的幸福

    仅有的幸福2017-06-12 09:31:47

    NaN refers to Not-a-Number, isNaN(), if it is NaN, it returns true.
    Then 123 is not NaN, of course it returns false.
    '123' is type converted to Number type 123, so it returns false.

    reply
    0
  • 女神的闺蜜爱上我

    女神的闺蜜爱上我2017-06-12 09:31:47


    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-06-12 09:31:47

    This is to judge whether it is NaNthis special number....

    reply
    0
  • Cancelreply