|
|
|
|
|
by mattdw
4505 days ago
|
|
It's actually understandable, just tedious. Lot of dynamic typing/casting tricks. First, we set var '$' to bitwise NOT of [], which is -1 ([] casts to 0 or false depending on the operator): $ = ~[];
Then we re-set $ to an object: $ = {___: ++$,
$$$$: (![]+"")[$],
...
Which gives us: $.___ == 0 // ($ was still -1, now it's 0)
$.$$$$ == "f" // I think
The "f" is a bit clever: ![] == false
(![]+"") == "false"
(![]+"")[$] is an index on the string, and $ is now 0
That's as far as I've bothered. (edited for formatting) |
|