DEV Community

Cover image for Code anything in Javascript, with only 8 characters

Code anything in Javascript, with only 8 characters

Cat McGee on July 28, 2020

You can convert any Javascript code into these characters: ()[]{}!+ and only these characters. Here's how: Numbers We can get 0 by ...
Collapse
 
coleyg profile image
Cole Geerts

Reminds me of Brainfuck for sure, I love these sort of little esoteric-toy-language thingies!

Collapse
 
catmcgeecode profile image
Cat McGee

Yeah, the 6-character version is actually called JSFuck!

Collapse
 
seanolad profile image
Sean

You crack me up, I can't believe you said it reminds you of Brainf**k. You got jokes. 😂 😂

Collapse
 
jalal246 profile image
Jalal 🚀

i mean, i sometimes have difficulties reading code but this line:

[][(![]+[])[+[]+!![]+!![]+!![]]+([]+{})[+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]][([]+{})[!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!![]]+([][+[]]+[])[+!![]]+(![]+[])[+[]+!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][+[]]+[])[+[]]+([]+{})[!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([]+{})[+!![]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+(!![]+[])[!+[]+!![]+!![]]+(!![]+[])[+[]]+([][+[]]+[])[+[]]+(!![]+[])[+!![]]+([][+[]]+[])[+!![]]+([]+{})[!+[]+!![]+!![]+!![]+!![]+!![]+!![]]+([][+[]]+[])[+[]]+([][+[]]+[])[+!![]]+(!![]+[])[!+[]+!![]+!![]]+(![]+[])[+[]+!![]+!![]+!![]]+([]+{})[!+[]+!+[]+!+[]+!+[]+!+[]]+(+[]+{})[+!![]]+([]+[][(![]+[])[+[]+!![]+!![]+!![]]+([]+{})[+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]][([]+{})[!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!![]]+([][+[]]+[])[+!![]]+(![]+[])[+[]+!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][+[]]+[])[+[]]+([]+{})[!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([]+{})[+!![]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+(!![]+[])[!+[]+!![]+!![]]+(!![]+[])[+[]]+([][+[]]+[])[+[]]+(!![]+[])[+!![]]+([][+[]]+[])[+!![]]+([]+{})[!+[]+!![]+!![]+!![]+!![]+!![]+!![]]+(![]+[])[+[]+!![]+!![]]+([]+{})[+!![]]+([]+{})[!+[]+!+[]+!+[]+!+[]+!+[]]+(+[]+{})[+!![]]+(!![]+[])[+[]]+([][+[]]+[])[!+[]+!![]+!![]+!![]+!![]]+([]+{})[+!![]]+([][+[]]+[])[+!![]])())[!+[]+!![]+!![]]+(!![]+[])[!+[]+!![]+!![]])()([][(![]+[])[+[]+!![]+!![]+!![]]+([]+{})[+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]][([]+{})[!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!![]]+([][+[]]+[])[+!![]]+(![]+[])[+[]+!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][+[]]+[])[+[]]+([]+{})[!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([]+{})[+!![]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+(!![]+[])[!+[]+!![]+!![]]+(!![]+[])[+[]]+([][+[]]+[])[+[]]+(!![]+[])[+!![]]+([][+[]]+[])[+!![]]+([]+{})[!+[]+!![]+!![]+!![]+!![]+!![]+!![]]+(!![]+[])[!+[]+!![]+!![]]+(![]+[])[+[]+!![]+!![]+!![]]+([]+{})[!+[]+!+[]+!+[]+!+[]+!+[]]+(+[]+{})[+!![]]+([]+[][(![]+[])[+[]+!![]+!![]+!![]]+([]+{})[+!![]]+(!![]+[])[+!![]]+(!![]+[])[+[]]][([]+{})[!+[]+!+[]+!+[]+!+[]+!+[]]+([]+{})[+!![]]+([][+[]]+[])[+!![]]+(![]+[])[+[]+!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][+[]]+[])[+[]]+([]+{})[!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([]+{})[+!![]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+(!![]+[])[!+[]+!![]+!![]]+(!![]+[])[+[]]+([][+[]]+[])[+[]]+(!![]+[])[+!![]]+([][+[]]+[])[+!![]]+([]+{})[!+[]+!![]+!![]+!![]+!![]+!![]+!![]]+(![]+[])[+[]+!![]+!![]]+([]+{})[+!![]]+([]+{})[!+[]+!+[]+!+[]+!+[]+!+[]]+(+[]+{})[+!![]]+(!![]+[])[+[]]+([][+[]]+[])[!+[]+!![]+!![]+!![]+!![]]+([]+{})[+!![]]+([][+[]]+[])[+!![]])())[!+[]+!![]+!![]]+(!![]+[])[!+[]+!![]+!![]])()(([]+{})[+[]])[+[]]+HEXA_VALUE)
Enter fullscreen mode Exit fullscreen mode

is this a virus injection in js 😂

Collapse
 
catmcgeecode profile image
Cat McGee

Hahaha, looks like it! 😂 It's so fun

Collapse
 
jalal246 profile image
Jalal 🚀

yeah, imagine you have to debug entire function written like this. good luck with that 😂😌

Thread Thread
 
drazendotlic profile image
Drazen Dotlic

No problem! I know, I know, we'll use sourcemaps 😜😂🤣

Collapse
 
seanolad profile image
Sean

What the F**k is that!! 👿

Collapse
 
penguintheorem profile image
Attilio Urbani

I've discovered that actually is a language ! Anyway nice article

Collapse
 
seanolad profile image
Sean • Edited

F**k JS... I mean JSF**k. 🤪

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

I'm too hungover for this...

Collapse
 
jonrandy profile image
Jon Randy 🎖️

I believe you only need 6 characters - ()+[]!

There's a converter to encode normal javascript here

Collapse
 
catmcgeecode profile image
Cat McGee

Yeah! I mentioned this at the end of the article. It's very complicated and I don't know how it works, so I went for the less complex 8 character one 😅

Collapse
 
devtony101 profile image
Miguel Manjarres

Awesome post, very nice explained! 👏🏻👏🏻

Collapse
 
catmcgeecode profile image
Cat McGee

Thank you!

Collapse
 
gkhan205 profile image
Ghazi Khan

Just great information you have shared. Thanks a lot :). After reading this post. I feel like I know nothing about JS. :(.

Collapse
 
catmcgeecode profile image
Cat McGee

Nooo don't think that way! This post is just crazy haha

Collapse
 
gkhan205 profile image
Ghazi Khan

yeah. but this is damn good information.

Collapse
 
chiubaca profile image
Alex Chiu

brilliant! lol

Collapse
 
scroung720 profile image
scroung720 • Edited

Super cool article there you have my unicorn vote. Correct me if I am wrong but where it says 'The third character here would be p.' I believe you meant 'The fourth character...' because the fourth characters on http/https is p.

Collapse
 
catmcgeecode profile image
Cat McGee

Yes you are correct!

Collapse
 
mrmaint profile image
AlexInAuburn • Edited

I tried the link for JSF... and converted the line: console.log("Hello");
I pasted the result in a file and executed it with node and got this...
C:\Users\MrMaint\ts>node a.js
C:\Users\MrMaint\ts\a.js:1
[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(+(!+[]+!+[]+!+[]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([]+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[

TypeError: Cannot read property 'eundefinednstruetundefinedr' of undefined
at Object. (C:\Users\MrMaint\ts\a.js:1:69)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3

What am I missing here???

Collapse
 
mzaini30 profile image
Zen

Hahahhaa... JS fvck

Collapse
 
thestillfracture profile image
Chris Howard

Would this be at all useful for obfuscation?

Collapse
 
catmcgeecode profile image
Cat McGee

Yeah it could be!

Collapse
 
designeranna1 profile image
Designer Anna

Thanks for this amazing tutorial.

Collapse
 
tclain profile image
Timothée Clain

That's like the anti minifier . compiling normal js to this notation actually makes the codes bigger. Very nice !

Collapse
 
tylerlwsmith profile image
Tyler Smith

Hogwarts will be sending you a letter shortly because this is some of that Tom Riddle magic

Collapse
 
titi profile image
Thibault ROHMER

More compact implementation for some chars here: github.com/TiTi/jswtf/blob/master/...