亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

In JavaScript, except for NaN, are all other variables equal to itself?
學習ing
學習ing 2017-07-05 10:50:13
0
4
1559

How does javascript quickly determine whether the value of a variable val is NaN? If, except for NaN, all other variables are equal to itself, then just judge val===val directly?

學習ing
學習ing

reply all(4)
劉奇

NaN is the only non-reflexive value in JavaScript, which is

NaN === NaN // false

This book mentions:

NaN is a very special value in that it's never equal to another NaN value (i.e., it's never equal to itself). It's the only value, in fact, that is not reflexive (without the Identity characteristic x === x) . So, NaN !== NaN.

JavaScript you don’t know

女神的閨蜜愛上我

Yes, NaN can be judged using isNaN or whether it is equal to yourself

At the same time, conversely, if two variables are equal to determine whether the two variables are the same, there are special cases of +0 and -0, and use the reciprocal to determine whether they are equal.

阿神
let a = []
let b = []

console.log(a===b)

Would you like to give the question a try?

曾經(jīng)蠟筆沒有小新

ES6 provides a new Number.isNaN() method on the Number object. It is recommended to use Number.isNaN() directly to check whether a value is NaN.
In addition, except for the cases of +0 and -0, === meets the needs. A better way is to use Object.is()

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template