Answer the question
In order to leave comments, you need to log in
How is type casting done with non-strict equality?
How does such a comparison take place? Why does the console output true
in such a comparison?
console.log(!!"false" == !!"true");
Answer the question
In order to leave comments, you need to log in
Non-empty strings in logical operations (you use boolean negation) are cast to true.
(!!"false" == !!"true") → (!!true == !!true) → (!false == !false) → (true == true) →
true nothing to do with it, you have both values when compared, they have the same type, boolean.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question