- Joined
- Aug 2, 2016
- Messages
- 954
- Reaction score
- 1,117
- First Language
- Finnish
- Primarily Uses
- RMMZ
Hello fellow RPG Makers!
As title says it's possible to write working JS code with only 6 characters (not saying it's efficient way)! But basically you execute any JS with []()+! characters.
Why? Because we can
...and to learn JS in rather 'primitive' level, it takes a lot of knowledge to solve how below example works. If you copy paste that example (in spoiler) to your console it will execute "prompt" and "alert" with your input. This example is ok to execute, but usually DO NOT execute this kind of code, if you see similar code in internet.
And please use this knowledge RESPONSIBLY! I will haunt you, if you use this in anything illegal or morally wrong!
Below example in 'plain text':
I created this example with my custom made function that returns string as []()+! characters (not ready for release).
How does it work? Very basics are knowledge of String, Array, Boolean, Number, Function, and constructors.
First you try to form characters with given primitives example: ![] = false then you convert it to string like this: ![]+[] it will give 'false' after that you already cover letters: f, a, l, s, and e. !![]+[] = 'true' gives extra letters: t, r, and u
Little bit more: [][[]]+[] = 'undefined' that gives extra letters: n, d, and i
To get letters from these strings would need 'numbers' example:
0 = +[]
1 = +!+[]
2 = +!+[]+!+[]
Numbers after 9 are 'stringified' for more compact code. Example 11 = (+!+[])+[]+(+!+[]) instead of +!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]
With this info given character 'f' would be: (![]+[])[+[]] = 'false'[0]
And 'led' string would be: (![]+[])[+!+[]+!+[]]+(![]+[])[+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]+!+[]]
After these basics you just try to find more letters to uncover!
+[![]]+[] = 'NaN'
[][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[] = 'function at() { [native code] }'
And so on...
This has been quite fun puzzle to me and I'm constantly seeking more ways to challenge myself... it kind of keeps me going after several decades of programming!
Happy learning moments and I encourage you to ask/discuss anything related to this topic.
As title says it's possible to write working JS code with only 6 characters (not saying it's efficient way)! But basically you execute any JS with []()+! characters.
Why? Because we can
And please use this knowledge RESPONSIBLY! I will haunt you, if you use this in anything illegal or morally wrong!
Below example in 'plain text':
Code:
[]['at']['constructor']('alert("hello "+prompt("give a name"))')()
Code:
[][(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(![]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+(!![]+[])[+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]((![]+[])[+!+[]]+(![]+[])[+!+[]+!+[]]+(![]+[])[+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[(+!+[])+[]+(+!+[])+[]]+([]+[])[(![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(![]+[])[+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]()[(+!+[])+[]+(+!+[]+!+[])+[]]+(+((+!+[])+[]+(+[])+[]+(+!+[])+[]))[(!![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+[])[([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(![]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+(!![]+[])[+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][[]]+[])[+!+[]]+(![]+[])[+!+[]]+((+[])[([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(![]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+(!![]+[])[+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[(+!+[])+[]+(+!+[])+[]]+(![]+[])[+!+[]+!+[]+!+[]+!+[]]]]((+!+[]+!+[])+[]+(+!+[])+[])[+!+[]]+(![]+[])[+!+[]+!+[]+!+[]+!+[]]+(![]+[])[+!+[]+!+[]]+(![]+[])[+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+[])[(![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(![]+[])[+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]()[(+!+[])+[]+(+!+[]+!+[])+[]]+(+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]])+[])[+!+[]+!+[]]+(+((+!+[]+!+[])+[]+(+!+[])+[]+(+!+[])+[]))[(!![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+[])[([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(![]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+(!![]+[])[+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][[]]+[])[+!+[]]+(![]+[])[+!+[]]+((+[])[([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(![]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+(!![]+[])[+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[(+!+[])+[]+(+!+[])+[]]+(![]+[])[+!+[]+!+[]+!+[]+!+[]]]]((+!+[]+!+[]+!+[])+[]+(+!+[])+[])[+!+[]]+(!![]+[])[+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+((+[])[([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(![]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+(!![]+[])[+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[(+!+[])+[]+(+!+[])+[]]+(+((+!+[]+!+[])+[]+(+!+[])+[]+(+!+[])+[]))[(!![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([]+[])[([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(![]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+(!![]+[])[+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][[]]+[])[+!+[]]+(![]+[])[+!+[]]+((+[])[([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(![]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+(!![]+[])[+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[(+!+[])+[]+(+!+[])+[]]+(![]+[])[+!+[]+!+[]+!+[]+!+[]]]]((+!+[]+!+[]+!+[])+[]+(+!+[])+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[(+!+[])+[]+(+!+[])+[]]+([]+[])[(![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(![]+[])[+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]()[(+!+[])+[]+(+!+[]+!+[])+[]]+(([]+[])[([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(![]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+(!![]+[])[+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[(+!+[])+[]+(+!+[]+!+[]+!+[]+!+[])+[]]+([][[]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[(+!+[]+!+[])+[]+(+!+[])+[]]+(![]+[])[+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(![]+[])[+!+[]]+((+[])[([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(![]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+(!![]+[])[+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[(+!+[])+[]+(+!+[])+[]]+(![]+[])[+!+[]+!+[]+!+[]+!+[]]+([]+[])[(![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(![]+[])[+!+[]+!+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]()[(+!+[])+[]+(+!+[]+!+[])+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[(+!+[])+[]+(+!+[]+!+[])+[]]+([][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[(+!+[])+[]+(+!+[]+!+[])+[]])()
I created this example with my custom made function that returns string as []()+! characters (not ready for release).
How does it work? Very basics are knowledge of String, Array, Boolean, Number, Function, and constructors.
First you try to form characters with given primitives example: ![] = false then you convert it to string like this: ![]+[] it will give 'false' after that you already cover letters: f, a, l, s, and e. !![]+[] = 'true' gives extra letters: t, r, and u
Little bit more: [][[]]+[] = 'undefined' that gives extra letters: n, d, and i
To get letters from these strings would need 'numbers' example:
0 = +[]
1 = +!+[]
2 = +!+[]+!+[]
Numbers after 9 are 'stringified' for more compact code. Example 11 = (+!+[])+[]+(+!+[]) instead of +!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]
With this info given character 'f' would be: (![]+[])[+[]] = 'false'[0]
And 'led' string would be: (![]+[])[+!+[]+!+[]]+(![]+[])[+!+[]+!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]+!+[]]
After these basics you just try to find more letters to uncover!
+[![]]+[] = 'NaN'
[][(![]+[])[+!+[]]+(!![]+[])[+[]]]+[] = 'function at() { [native code] }'
And so on...
This has been quite fun puzzle to me and I'm constantly seeking more ways to challenge myself... it kind of keeps me going after several decades of programming!
Happy learning moments and I encourage you to ask/discuss anything related to this topic.