Here is a JavaScript trivia question. Can the expression (aᅠ == 1 && a == 2 && ᅠa == 3) ever evaluate to true? Well, today I foun...
For further actions, you may consider blocking this person and/or reporting abuse
Nice post, I wouldn't have thought about using an "invisible" character.
Now, for the curious people, there is also another way :)
Just for reference, the concepts used here are type coercion, closures and immediate function invocation.
Regards
p.s. can
a === 1 && a === 2 && a === 3
evaluate totrue
?Yes, you also can make true from
a === 1 && a === 2 && a === 3
without invisible character, since, we have getter.Precisely, nice catch.
Nice, interesting approach!
Nice! Way more useful and interesting than the actual post.
This is very cool and scary!
This feels a little clickbait-y. It feels the same as photographing two glasses of water after 3 hours in the freezer, and then saying, “we put two glasses of water in the freezer and one of them didn’t freeze!” And then revealing that one glass was actually full of vodka.
I don’t want to try to misunderstand the spirit of this article, but I don’t get why any of this is relevant.
Haha exactly.
Changing
var
tolet
will give you a hintThat's right! Although for the hint to be useful you have to know that
let
throws an exception if you try to redeclare a variable.Does it not work if you set a to True since then 1,2,3 are cast to booleans and are evaluated at True aswell?
1,2,3
are not casted to booleans as they are primitive types themselves.In C bool is int is char
lol nice post :)
Maybe with the === operator?
As long as it's 3 different variables, the
===
operator will not be helpful. This is a "magic" trick, not a bug ;)