How to check if a variable is defined - JavaScript

The correct way to check if a JavaScript variable is defined is to check its type and compare it to the 'undefined' string (NOT as keyword).

	var isDefined = (typeof(myVar) !== 'undefined');
Powered by PepisCMS