本文介绍了NaN是假的吗?为什么NaN === false返回false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
- 为什么
NaN === false
=> false,是不是NaN falsy? - 为什么
NaN === NaN
=> false,但是!! NaN === !! NaN
=> true
- Why
NaN === false
=> false, isn't NaN falsy? - Why
NaN === NaN
=> false, but!!NaN === !!NaN
=> true
我一直绞尽脑汁试图解决这个问题。
I've been racking my brain trying to figure this out.
推荐答案
- Falsy 并严格等于
false
是非常不同的东西,这就是为什么一个人有y
而不是e
。 ;) -
NaN
规格永远不会等于任何东西。问题的第二部分是比较false === false
,这很有趣,true
:)
- Falsy and being strictly equal to
false
are very different things, that's why one has ay
instead of ane
. ;) NaN
is spec'd to never be equal to anything. The second part of your question is comparingfalse === false
, which is funnily enough,true
:)
这篇关于NaN是假的吗?为什么NaN === false返回false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!