You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The abstract equality operator converts both sides to numbers to compare them
This is just wrong. Strings are compared as strings, null compared to undefined is true, to-primitive might return a string instead on number and so on.
Here is how this expression simplifies:
+[] == +![];
First step would be to convert ![] to false because of precedence.
The text was updated successfully, but these errors were encountered:
so, overall, your state is absolutely correct , but here is the thing, [] == ![] , for this problem, even though ![] is firstly converted to boolean, there what the author meant is both sides are converted to numbers to be primitive both sides, :: If the types of the two operands are different, JavaScript attempts to convert them to a common type :: but your state is also true
Explanation of this example is wrong:
https://github.com/denysdovhan/wtfjs#-is-equal-
This is just wrong. Strings are compared as strings, null compared to undefined is true, to-primitive might return a string instead on number and so on.
First step would be to convert
![]
tofalse
because of precedence.The text was updated successfully, but these errors were encountered: