百度百科:NaN(Not a Number,非数字)是计算机科学中数值数据类型的一类值,表示未定义或不可表示的值。
虽然 NaN 是“Not a Number”,但是它的类型还是数值类型
`var a = 1 ;
var b = 1 + 1 ;
var c = 1 / 0 ; // 除数不能为0
console.log(c) ; // Infinity 无穷
console.log(typeof c) ; // 数字类型 number`
-
数字类型
-
常规数字
-
Infinity 无穷
-
NaN 非数字的集合 , 它不和任何值做比较,包含自己
console.log(NaN === NaN) ; // falseconsole.log(NaN > 1) ; // false -
isNaN() 用于判断是不是NaN 得到的是布尔值
`var result = isNaN(hou_duan) ;//--- 布尔值 console.log(result) ; // true`