Hi,
I got task:
a == false
!a == false
a == !a
As I understund, const a
should be equal to false
, because:
a = 10
a == false // true
!a == false // false
a == !a // false
Could somebody explain me this?
Thank you in advance.
I’m not sure what you’re getting at here. a
is equal to 10, as you set it to ten.
Also:
a = 10
a == false // false
!a == false // true
a == !a // false
Did I miss something?
1 Like
Nope, it equals true
(only false
, null
, undefined
, 0
, and ''
are falsy)
m3g4p0p
4
You may find this article helpful:
Hint: The answer is a combination of the values @Dormilich mentioned… so much for the loose equality comparison. :-P
As a result, it’s best to stay away from the loose equality comparison and stick with the strict triple equals ===
comparison instead.
1 Like
m3g4p0p
7
Unless of course you want to write orthodox JS… :-)
4 Likes
system
Closed
9
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.