Is NaN equal to NaN?

前端 未结 8 2056
遇见更好的自我
遇见更好的自我 2020-11-27 05:22
parseFloat(\"NaN\")

returns \"NaN\", but

parseFloat(\"NaN\") == \"NaN\"

returns false. Now, that\'s probably a go

8条回答
  •  长情又很酷
    2020-11-27 05:45

    It's a special case, NaN is the only thing in Javascript not equal to itself.

    Although the other answers about strings vs the NaN object are right too.

提交回复
热议问题