What's true and false in Javascript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

What's true and false in Javascript

13th Sep 2017, 5:24 PM
<mr/>
<mr/> - avatar
9 Answers
+ 2
It's possible values of boolean variables
13th Sep 2017, 5:29 PM
matmozaur
matmozaur - avatar
+ 10
@Isomer, in terms of numbers it should be: true = -∞, -3, -2, -1 && 1, 2, 3, ∞ false = 0, NaN :D
13th Sep 2017, 5:41 PM
Maz
Maz - avatar
+ 9
@Isomer, not your bad... it's right what you said... i was just to emphasize. ^^
13th Sep 2017, 5:46 PM
Maz
Maz - avatar
13th Sep 2017, 5:46 PM
Akbar Khalilzadeh
Akbar Khalilzadeh - avatar
+ 4
true: true thing false:Imaginary Is this what ya want?
13th Sep 2017, 5:44 PM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 3
@Maz my bad.but most of times people use 1 for true
13th Sep 2017, 5:46 PM
Isomer
Isomer - avatar
+ 2
true=1 and false=0
13th Sep 2017, 5:39 PM
Isomer
Isomer - avatar
+ 2
false: false, 0, null , undefined , NaN , "" (empty string ) true : everythin' else.
13th Sep 2017, 5:48 PM
Rose Sevenyears
Rose  Sevenyears - avatar
+ 1
@Maz NaN is number too ;)
13th Sep 2017, 5:59 PM
Rose Sevenyears
Rose  Sevenyears - avatar