JS Tip of the Day: JSFuck


Believe it or not, but you can write JavaScript with no more that 6 characters. With nothing more than using only []()!+, you have the full power of JavaScript at your disposal. This is the idea behind JSFuck. From its website:

JSFuck is an esoteric and educational programming style based on the atomic parts of JavaScript. It uses only six different characters to write and execute code.

The following is an example of a Hello, world! script in JSFuck:

All of that delightful mess translates simply to:

console.log('hello world')

The way this works is by using the []()!+ characters in ways that creates other characters that can in turn be used to access more characters and so on and so forth. See the Github page for more information on how it works and the website for a converter to craft your own JSFuck scripts.

If you’re curious about the name, it comes from another programming language known as Brainfuck which similarly is a minimalistic, esoteric language consisting of only 8 command characters.

More info: