javascript NaN

Posted by bower on September 25, 2011
javascript

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

javascript 中有一个值NaN 它是一个怪胎

NaN 的意思是 Not a Number

但是 typeof NaN  // number 也就是说 NaN是数字类型的 ecma的文档里确实这么写的

而且NaN于任何值做 ==, === 比较运算结果都是false

NaN == NaN //false NaN甚至不等于他自己

NaN == true // false

NaN == false //false   这家伙不是true也不是false

 

NaN就是NaN 它是数字但不能参加运算。。

 

分享到:人人网开心网腾讯微博新浪微博豆瓣分享腾讯空间百度搜藏腾讯书签

分享给你的朋友->bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Leave a Reply

Your email address will not be published. Required fields are marked *

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word