Sign in
Log inSign up
Time for some JavaScript humour! 😜

Time for some JavaScript humour! 😜

Tommy Hodgins's photo
Tommy Hodgins
·Dec 4, 2016

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

<body>
<style>
body { margin      : 0              }
body { background  : #111           }
div  { float       : left           }
div  { width       : calc(100%/256) }
div  { padding-top : calc(100%/256) }
</style>
<script>
;;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')
;;;;;;;;pixel.style.background='#'+hue[r]+hue[g]+hue[b]
;;;;;;;;document.body.appendChild(pixel)
;;;;;;}
;;;;}
;;}
</script>

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 🤓