How does this return false? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How does this return false?

How does this code return false: var a, b = "undefined"; console.log(a==b);

8th Feb 2021, 2:54 AM
Mohammed Kashif
Mohammed Kashif - avatar
2 Answers
+ 6
https://code.sololearn.com/c4ba1u004tBh/?ref=app Answer will be false because you have written undefined, under double quotes "" which is considered as string and string is not equal to undefined
8th Feb 2021, 3:03 AM
Abhiyantā
Abhiyantā - avatar
+ 2
Thanks a lot!
8th Feb 2021, 3:17 AM
Mohammed Kashif
Mohammed Kashif - avatar