NaN
is the result of a failed Number
operation.
1 + undefined // NaN
"1" + undefined // "1undefined"
1 + "" + undefined // "1undefined"
1 + ("" + undefined) // "1undefined"
typeof NaN // "number"
typeof undefined // "undefined"
NaN === NaN // false (it's not reflexive!)
undefined === undefined // true (it's reflexive)
NaN.toString() // "NaN"
NaN
means Not a Number where a number was expected. Any Number operation with NaN
will result in NaN
as well.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…