[X]

JSFuck

luljs 2012 still works

Any JavaScript program can be written using only the six characters square bracket, round bracket, bang and plus.

In 2026: The building blocks still evaluate the same in every engine. +[] is 0, ![] is false, !![] is true, and !+[]+!+[] is 2, so any number is reachable by counting. Indexing the strings "false", "true" and "undefined" yields letters, as in (![]+[])[+[]] giving "f", and the Function constructor turns letters back into runnable code. Those steps are enough to write any program with six symbols.

Where it came from: JSFuck by Martin Kleppe, jsfuck.com, 2012. jsfuck.com

<script>
function row(expr, val){ document.write('<p><code>' + expr + '</code> is <b>' + val + '</b></p>'); }
row('+[]', JSON.stringify(+[]));
row('![]', JSON.stringify(![]));
row('!![]', JSON.stringify(!![]));
row('!+[]+!+[]', JSON.stringify(!+[]+!+[]));
row('[][[]]', String([][[]]));
row('(![]+[])[+[]]', JSON.stringify((![]+[])[+[]]));
document.write('<p>Six characters, <code>[ ] ( ) ! +</code>, reach every number, letter and function.</p>');
</script>
sandboxed demo · breaks nothing but itselfrestart

More in luljs

all 63 in luljs › · the whole library ›