(! [] [] ![]).length 9 code example
Example: (!+[]+[]+![]).length 9
// We start with
(! + [] + [] + ![]).length // Remember that we are going from right to left starting
// with the operation before doing -length
![] === false // ! converts the content of [] to true, since it's not part of
// the false group above, and then reverts it.
+ === + // the + is lonely so far with no operand to the right but sticks
// around since it has something on the left.
[]+[] === "" // The contents of [] can't be added or converted to a number so
// the right operand becomes a string. There's still something to
// the left so the + stays.
!+[] === true // This the same as !+0 since +[] is 0
// Now we got:
("false" + "" + false).length
""+false === "false" // + adds "" to false. It then sticks around.
"true" + "" === "true" // The + stays after adding "true" to ""
// ---
("true"++"false")
+"false" ==== "false" // + has nothing but an operand to the left so it goes away.
true + "" === "true" // + adds them together and stays
// ---
("true"+"false")
"true" + "false" === "truefalse" // + still stays
// ---
(+"truefalse")
+"truefalse" === "truefalse" // + has nothing to do after this so it goes away
// ---
("truefalse") // The operation is done so now we are left with what's outside.
"truefalse".length === 9