Wow - how does this work? Does anyone know or have a link to a place that might explain this?
so "NaN"[1] would be "a". "false"[0] would be "f".
since they are trying to do it without numbers, they can create them using things like "++[[]][+[]]" which returns a 1. by adding up different numbers you can get the digits you need.
Edit: by using []["sort"]["call"]()["eval"]
+[]
or
[]['sort']
or
[]['eval']
for that matter, why does []['sort']['call'] work but []['call'] doesn't.
All of these look like they should be syntax errors to me. What am I missing?
[]["sort"]["call"]()["eval"]
is the same in javascript as ([].sort.call()).eval
The part in parentheses calls Array.sort with an undefined this object, defaulting it to window. Array.sort returns this after it's done. Global functions like eval are stored on window, so you end up with window.eval. 0: 3: +[]
1: 11: ++[[]][+[]]
2: 20: ++[++[[]][+[]]][+[]]
3: 29: ++[++[++[[]][+[]]][+[]]][+[]]
(etc)