Amusing Javascript Snippet

Written by pete

Topics: Blogging, Code, Snippets, Uncategorized

I saw this posted on Jacqui Maher’s blog today and was so amused I had to reblog it.

if (!(typeof worldHasEnded == "undefined")) {
   document.write("YUP.");
} else {
   document.write("NOPE.");
}

From http://hasthelargehadroncolliderdestroyedtheworldyet.com/.

Aside from the very obvious “you don’t need to negate that test condition, just reverse your simple if and else clauses” issue, it’s quite amusing.

Clever. I like it.