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]

19 thoughts on “Writing Javascript Without Using Any Letters Or Numbers

  1. 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.

Leave a Reply to Blue Footed BoobyCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.