alert(1/0)
警报 Infinity
和 alert(1/-0)
警报 -Infinity
. alert(-1/-0)
提醒 Infinity
,正如我在使用 实数 进行一些操作时所期望的那样。我不能说无穷大是一个可测量的值。 javascript 是否认为它是某个数字?
最佳答案
是的,Infinity
和-Infinity
是special values of the Number type .来自 ES5 规范:
There are two other special values, called positive Infinity and negative Infinity. For brevity, these values are also referred to for expository purposes by the symbols +∞ and −∞, respectively. (Note that these two infinite Number values are produced by the program expressions
+Infinity
(or simplyInfinity
) and-Infinity
.)
另请注意,NaN
也是 Number 类型的值,尽管它是“非数字”的首字母缩写词。
关于javascript - 无穷大是javascript中的某个数字吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24166320/