Return to Snippet

Revision: 56140
at March 12, 2012 09:58 by EvanHahn


Initial Code
// As a function
Evan.isUndefined = function(u) {
	return typeof u === 'undefined';
};

// In an "if"
if (typeof foo === 'undefined') {
	// ...
}

Initial URL


Initial Description
Checking for `undefined` in JavaScript is weird (the variable can be redefined), so I made a function to do it. This stuff (and others) is also in my [JSTypes](https://github.com/EvanHahn/JSTypes) type-checking library.

Initial Title
Is something undefined in JavaScript?

Initial Tags


Initial Language
JavaScript