For every JavaScript learner must know. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 22

For every JavaScript learner must know.

JavaScript truth table: ' ' == '0' // false 0 == ' ' // true 0 == '0' // true false == 'false' // false false == '0' // true false == undefined // false Source: Doug Crockford

27th Feb 2017, 5:36 AM
Ram chandra Giri
Ram chandra Giri - avatar
6 Answers
+ 6
Thanks! typeof(NaN) == 'number' typeof(null) == 'object' typeof(document.all) == 'undefined'
27th Feb 2017, 11:28 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 18
Remaining: false == null //false null == undefined //true " \t\r\n" == 0 //true
27th Feb 2017, 5:38 AM
Ram chandra Giri
Ram chandra Giri - avatar
+ 13
Thanks for this @Ram
27th Feb 2017, 6:33 AM
Siddharth Saraf
+ 3
That's crazy!
27th Feb 2017, 5:55 AM
Zilvinas Steckevicius
Zilvinas Steckevicius - avatar
+ 3
thanks for Give it to us
27th Feb 2017, 6:27 AM
Drishnev Singh
Drishnev Singh - avatar
+ 1
false == 'false' //false because false IS a boolean and falsz à string. false == 0 && false == false //true
27th Feb 2017, 8:20 AM
Hickacou
Hickacou - avatar