Live data from Hacker News

Writing JavaScript with Only Six Characters

javascript.christmas

1–10 of 18 posts

Re: Writing JavaScript with Only Six Characters

#5
Is there a limit to what one can do with these six characters? Like, now we're reading values from the string "false". We also could read from "true", and maybe undefined (how?). But can one do more? If one can generate "window", one should be able to call functions through window["functionName"]() and do general computing with this, I think?

Re: Writing JavaScript with Only Six Characters

#8

Is there a limit to what one can do with these six characters? Like, now we're reading values from the string "false". We also could read from "true", and maybe undefined (how?). But can one do more? If one can generate "window", one should be able to call functions through window["functionName"]() and do general computing with this, I think?

you can obtain undefined by accessing the first element of an empty array. `([])[+!![]]`

Re: Writing JavaScript with Only Six Characters

#9

Is there a limit to what one can do with these six characters? Like, now we're reading values from the string "false". We also could read from "true", and maybe undefined (how?). But can one do more? If one can generate "window", one should be able to call functions through window["functionName"]() and do general computing with this, I think?

As I understand, there's no limit to what you can do with these six characters.

It quickly gets more complicated though, and will require alot more code:

"undefined": [][![]]+[] (empty array accessed at index 0 turned into string)

"NaN": +{}

"[object Object][object Object]": {}+{}

.. etc

See the full list here:

https://github.com/aemkei/jsfuck/blob/master/jsfuck.js

Post reply on HN