Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
wessberg28yIt looks perfectly sane to me. 1 is loosely equal to true. Thus, !1 evaluates to false. !!1 then evaluates to false before negating the expression with the remaining ! to ultimately evaluate to true. Also, logical AND and OR operators loosely evaluates the expressions from left to right which in the first example becomes "true && true"
-
fyzrn27498y@wessberg yes, but the thing that made me scratch my head is that true && 1 returns 1 instead of true :/
-
false && X == false
true && X == X
false || X == X
true || X == true
easy as that.
First and last one work even if X throws an error
Related Rants
true && 1
> 1
true && !!1
> true
Welcome to Javascript
undefined
quirky motherfucker
js
coercion