[問題] Why NaN and Infinity are classified as the type of numbe
I have practiced Javascript for a long long time,
and there's always a contradiction, which has confused me so much.
That is, why NaN and Infinity are both types of “number”?
In mathematics,“Infinity”is just a concept, not a number.
“NaN”means“Not a number”on its literal meaning.
Obviously those are not“numbers.”
However, in Javascript, both“NaN”and“Infinity”are“number.”
You can try it like below:
typeof NaN // Returns“number”
typeof Infinity // Returns“number”
So what's the reason?
Could someone tell me the reason about this weird contradiction?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 42.145.142.148
※ 文章網址: https://www.ptt.cc/bbs/Ajax/M.1500617454.A.083.html
→
07/21 14:19, , 1F
07/21 14:19, 1F
→
07/21 14:32, , 2F
07/21 14:32, 2F
推
07/21 22:58, , 3F
07/21 22:58, 3F
推
07/22 01:27, , 4F
07/22 01:27, 4F
推
07/24 10:07, , 5F
07/24 10:07, 5F
推
07/24 15:20, , 6F
07/24 15:20, 6F
推
07/25 22:33, , 7F
07/25 22:33, 7F
推
07/30 03:24, , 8F
07/30 03:24, 8F
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章