gpt4 book ai didi

javascript - 在 JavaScript 中给定 x!=x。 'x' 的类型是什么?

转载 作者:行者123 更新时间:2023-12-04 01:59:50 26 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





Why is NaN not equal to NaN? [duplicate]

(6 个回答)


6年前关闭。




我在一次 JavaScript 面试中被问到

If x!=x is TRUE, what is the possible type of x?



面试官告诉我, x 只有一种可能的类型。得到这个结果。

最佳答案

值为NaN ,它的类型是 Number。

来自 the spec比较相等性:

If x is NaN, return false.


NaN永远不等于任何东西,包括它自己。

关于javascript - 在 JavaScript 中给定 x!=x。 'x' 的类型是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32456893/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com