JavaScript, JavaScript

2010-04-06 00:00:00 +0100 by Alex R. Young

JavaScript, JavaScript is a blog by Angus Croll in which he discusses high-level JavaScript concepts
and techniques. Recent articles include tutorials on
closures, throw, and

It's a blog that's worth following if you're interested in improving
your JavaScript fundamentals.

var undefined = true

This post on reddit is amusing: var undefined = true; /* the best way
to screw up whole javascript apps

It's not really as bad as it sounds because most of us do this:

if (typeof made_up_variable === 'undefined') { alert("it's cool, I'm cool.") }

The other way would be to write the following:

var magic_var;
if (magic_var == undefined) { alert('undefined!'); }

undefined = true;
magic_var = true;
if (magic_var == undefined) { alert('undefined!'); }

This has the worrying outcome of displaying undefined for both cases.