In JavaScript, which value is not equal to itself, when we compare them?? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

In JavaScript, which value is not equal to itself, when we compare them??

Value types

4th Apr 2019, 6:46 AM
Abdul Rasul
Abdul Rasul - avatar
4 Réponses
+ 1
NaN is not equal to itself console.log(NaN == NaN); // false console.log(NaN === NaN); // false console.log(NaN != NaN); // true
4th Apr 2019, 7:19 AM
VEDANG
VEDANG - avatar
0
Depends on definition of equality, right? :)
4th Apr 2019, 6:57 AM
::sк::
::sк:: - avatar
0
NaN is not equal to itself in most languages.
4th Apr 2019, 6:58 AM
Dragonxiv
Dragonxiv - avatar
0
[0] == [0] returns false [0] === [0] returns false [0,0] == [0,0] returns false [0,0] === [0,0] returns false [0,x] == [0, x] (where x is seemingly any integer) returns false [0,x] === [0, x] (where x is seemingly any integer) returns false I hope this helped!
16th Feb 2023, 7:37 PM
MeBeQuack
MeBeQuack - avatar