The result of the condition isn't a boolean, it's the value of the condition which is can be truthy or falsey as well | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

The result of the condition isn't a boolean, it's the value of the condition which is can be truthy or falsey as well

When you do any conditional statement it doesn't always return true or false but the a value of the condition. Var bob = 3; Var Dave = 'I'm dave' ; If (bob && Dave) returns 'I'm dave' not true, as a string is truthy Var Dave = 0 If (bob && Dave) Returns 0 which is falsey.

15th Feb 2017, 8:19 AM
Sam
2 Answers
+ 7
AFAIK, everything which is not 0 or not false is true.
15th Feb 2017, 12:02 PM
Hatsy Rei
Hatsy Rei - avatar
0
The result of the condition statement is always: // A Boolean value (true or false)
2nd Jul 2020, 6:55 AM
Rustamjon Kosimov
Rustamjon Kosimov - avatar