vvvvvvv [0] (![]+[])[[]-[]] = "false"[0] ^^^^^^^^ "false" vvvvvvv again [0] (([]+[])+([][[]]))[[]-[]] = "undefined"[0] ^^^^^^^^^^^^^^^^^^ "undefined" vvvvvvvvv this time [1] (([]+[])+([][[]]))[!![]-[]] = "undefined"[1] ^^^^^^^^^^^^^^^^^^ again "undefined"
So you get "f"+"u"+"n" === "fun" .
Further explanation
"false"
![] - false . +[] just acts like converting to a string. Thus, we get the string "false" .
"undefined"
One of the operands must be a string. This is done using []+[] . The actual undefined is created on the right side: [][[]] === [][0] , the first record of an empty undefined array.
Zeta
source share