Why does typeof NaN return 'number'?

前端 未结 21 1513
误落风尘
误落风尘 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:15

    This is simply because NaN is a property of the Number object in JS, It has nothing to do with it being a number.

提交回复
热议问题