Start a personal dev blog on your domain for free with Hashnode and grow your readership.
Get Started

Time for some JavaScript humour! 😜

I took all the semicolons from my CSS and used them as indentation in my JS

body { margin      : 0              }
body { background  : #111           }
div  { float       : left           }
div  { width       : calc(100%/256) }
div  { padding-top : calc(100%/256) }
;;var hue = [0,1,2,3,4,5,6,7,8,9,'a','b','c','d','e','f']
;;for (r=0;r<hue.length;r++){
;;;;for (g=0;g<hue.length;g++){
;;;;;;for (b=0;b<hue.length;b++){
;;;;;;;;var pixel=document.createElement('div')

Your scientists were so preoccupied with whether or not they could, they didn’t stop to think if they should.

Please reply with any useless, but amusing code you have 🤓

Start a personal dev blog on your domain for free and grow your readership.

3.4K+ developers have started their personal blogs on Hashnode in the last one month.

Write in Markdown · Publish articles on custom domain · Gain readership on day zero · Automatic GitHub backup and more

Marco Alka's photo

Disclaimer: Very bad JS ahead. Do not copy that style!

well, the terminal code for SHPS is very old and hacky and contains crap, like

me.on('line', function f_commandline__on_line($line) {

    $line = $line.trim();
    var tokens = $line.split(' ');
    //ohmygod, this should really be exchanged with some eventing action
    switch (tokens[0]) {

        // a few commands here

        // The following sentence will destroy the AI's emotional memory. Very sad.
        case 'what do you see when you close your eyes':
        case 'exit': {

            process.exit(0); //todo: nice shutdown

        case 'help': {

            me.write('We are truely sorry, but help has not been implemented, yet  :/\n');

        case 'lick': {

            // I'm sorry, but I had to put this here...
            var buf = new Buffer('D........Q===', 'base64');// contains some song lyrics
            me.write(buf.toString('utf-8') + '\n');


        case 'whoami': {


        case 'cache': {

            me.write('Not Implemented yet');

The memory-destroying sentence will not even work, because I only switch for the first token.... I really should take some time to clean the module, but the web GUI is just more important at the moment :(

Nate Ebel's photo

next project: a linter that enforces this style

Max Bachhuber's photo

I don't get it

Tommy Hodgins's photo

In CSS, multiple properties in the same rule are separated by semicolons ';', and in JavaScript semicolons end a statement. In this example I had to write multiple 'redundant' CSS rules each containing only one property so I could avoid using a semicolon there, and in my JavaScript instead of indenting with tabs or spaces, I used empty statements at the start of the line to push my real code over. It's valid CSS and valid JS, but completely nonsensical formatting :D