Why does typeof NaN return 'number'?

前端 未结 21 1514
误落风尘
误落风尘 2020-11-22 05:38

Just out of curiosity.

It doesn\'t seem very logical that typeof NaN is number. Just like NaN === NaN or NaN == NaN returning

21条回答
  •  日久生厌
    2020-11-22 06:14

    NaN is still a numeric type, but it represents value that could not represent a valid number.

提交回复
热议问题