Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It looks like the generator is suboptimal, but still really cool.

(![]+[])[+!+[]] evaluates to "a" as well. It looks like it turns it into an array twice.

It goes +!+[] === 1 then [+!+[]] === [1] then +[[+!+[]]] === 1 then [+[[+!+[]]]] === [1]



Maybe one could run the output through Closure Compiler to get a bit better code ;-)

(Ok, tried it, it evaluates plenty of numbers on its own already which increases the character set. Not nice).


Ah! You're right. Confusing.

Also confusing that "false"[[1]] works.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: