Writing Javascript without using any letters or numbers

Did you know it’s possible to write Javascript code without using any letters or numbers at all? Well, it’s not just Javascript, but that’s the language used in this demonstration. [Patricio Palladino] shows how code can be written using just eight characters, and all of them are punctuation marks.

Typecasting is the name of the game here. By starting out with an empty array formed by a pair of square brackets, [Patricio] can generate the number zero by casting the array with the plus sign. From there he can use an exclamation point (a boolean cast) and addition to generate any number. The image above is an example of the digits 0-9. This would get very tedious for larger numbers but there’s another shortcut. Cast the digits to strings, concatenate them, then cast back to a number and you’re in business.

The technique is fascinating, and basically unreadable. As a proof of concept he wrote a parser that will convert any Javascript into this hieroglyphy. Check out his Github repository to give it a try.

[via Reddit]


  1. gizmoguy says:

    Heh, reminds me of Church numbers.

  2. Benny Born says:

    I already knew about this method but I guess it’s useless except for obfuscation and blowing things up ;)

    Anyway looking at this reminds me totally of Brainfuck

  3. Brian Tkatch says:

    Clean and Dirty, Perl has this beat. :)

  4. acomputerdog says:

    I just tried it out,

    MOD EDIT: holy crap use pastebin, people.

    actually executes! and does what it is supposed to!

  5. denis says:

    Brought my poor old iPhone 4 to a crawl,cheers ;)

  6. jaromirs says:

    I prefer BrainFuck.

  7. Velli says:

    Georg Cantor says hello.

  8. tns says:
  9. andar_b says:

    Reminds me of when I proved HTMLgoodies wrong in High School – the site said there was NO way to display an image using only a single web page in HTML with no IMG tags. It only worked in Netscape but I showed you could use a table of 1px cells with background colors.

    The code took far more space than the image file would have, but it was a solution.

  10. Renee says:

    Set theory FTW!

  11. Galane says:

    And the Lifetime Achievement Award for Obfuscated Code goes to…

  12. iiiears says:

    This was fun. Java, Perl, .. Lua script?..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 96,731 other followers