r/javascript • • Oct 26 '24

AskJS [AskJS] A fun line of code I wrote using JavaScript's coersion

console.log(((!![]+[])+!![]+![])[+!+[]+[+!+[]]]+([][[]]+[])[+[]]+([![]]+({}+[]))[+!+[]+[+[]]]+([![]]+({}+[]))[+!+[]+[+[]]]+({}+[])[+!+[]]+([][[]]+[])[+!+[]]+([][[]]+[])[!![]+!![]]+([!![]]+[][[]])[+!+[]+[+!+[]]]+([!![]]+[][[]])[+!+[]+[+!+[]]]+((!![]+[])+!![]+![])[+!+[]+[+!+[]]]+([][[]]+[])[+!+[]]+([][[]]+[])[+[]]+([]+!![])[+[]]+((!![]+[])+!![]+![])[+!+[]+[+!+[]]]);

0 Upvotes

6 comments sorted by

24

u/jessepence Oct 26 '24

Ahh, I can tell that you're new to this because you actually typed out "console.log". Oh, sweet summer child, it can get so much worse.

"'\"+'+",$=~[];$={___:++$,$$$$:(![]+"")[$],__$:++$,$_$_:(![]+"")[$],_$_:++$,$_$$:({}+"")[$],$$_$:($[$]+"")[$],_$$:++$,$$$_:(!""+"")[$],$__:++$,$_$:++$,$$__:({}+"")[$],$$_:++$,$$$:++$,$___:++$,$__$:++$};$.$_=($.$_=$+"")[$.$_$]+($._$=$.$_[$.__$])+($.$$=($.$+"")[$.__$])+((!$)+"")[$._$$]+($.__=$.$_[$.$$_])+($.$=(!""+"")[$.__$])+($._=(!""+"")[$._$_])+$.$_[$.$_$]+$.__+$._$+$.$;$.$$=$.$+(!""+"")[$._$$]+$.__+$._+$.$+$.$$;$.$=($.___)[$.$_][$.$_];$.$($.$($.$$+"\""+$.$_$_+(![]+"")[$._$_]+$.$$$_+"\\"+$.__$+$.$$_+$._$_+$.__+"(\\\"\\"+$.__$+$.___+$.$$_+$._+$.$$__+"\\"+$.__$+$.$_$+$._$$+"\\"+$.$__+$.___+"\\"+$.__$+$.$$$+$.__$+$._$+$._+"!\\\")"+"\"")())(),',)())()""\"+")"\\\!"+_.$+$_.$+$__.$+$$$.$+$__.$+"\\"+___.$+__$.$+"\\"+$$_.$+$_$.$+$__.$+"\\"+__$$.$+_.$+_$$.$+___.$+$__.$+"\\"\\\("+__.$+_$_.$+_$$.$+$__.$+"\\"+_$$$.$+]_$_.$[)""+][!(+_$_$.$+""\"+$$.$($.$($.$;]_$.$[]_$.$[)___.$(=$.$;$$.$+$.$+_.$+__.$+]$$_.$[)""+""!(+$.$=$$.$;$.$+$_.$+__.$+]$_$.$[_$.$+)]_$_.$[)""+""!(=_.$(+)]$__.$[)""+""!(=$.$(+)]_$$.$[_$.$=__.$(+]$$_.$[)""+)$!((+)]$__.$[)""+$.$(=$$.$(+)]$__.$[_$.$=$_.$(+]$_$.$[)""+$=_$.$(=_$.$;}$++:$__$,$++:___$,$++:$$$,$++:_$$,]$[)""+}{(:__$$,$++:$_$,$++:__$,]$[)""+""!(:_$$$,$++:$$_,]$[)""+]$[$(:$_$$,]$[)""+}{(:$$_$,$++:_$_,]$[)""+][!(:_$_$,$++:$__,]$[)""+][!(:$$$$,$++:___{=$;][~=$,"+'+"\'"

Welcome to JSFuck.

3

u/InTheEndEntropyWins Oct 26 '24

succondeesnuts

((!![]+[])+!![]+![]) = truetruefalse

[+!+[]+[+!+[]]] = [11]

'truetruefalse'[11]=s

And so on.

0

u/Ronin-s_Spirit Oct 27 '24

Ok? I can make a binary buffer iterable with inconspicuous read and write syntax for each iteration.
I cal also tell an array to be coerced to a number, where it will be multiplying all its number values together to produce a single number.
My reaction is mild because somebody wrote jsfuck and made a compiler for it before you.

1

u/Exceptionally-Mid Oct 31 '24

You are the arrogant programmer stereotype

3

u/Ronin-s_Spirit Oct 31 '24 edited Nov 01 '24

You don't understand do you? There's like a million videos doing this but better. Completely unimpressive, I'm not saying I'm amazing, I'm saying he did nothing of interest.
P.s. there's literally a compiler built for this out of vanilla javascript, and it will let you write anything without even thinking about it.