Deprecated: Assigning the return value of new by reference is deprecated in /home/creative/public_html/wp-settings.php on line 520

Deprecated: Assigning the return value of new by reference is deprecated in /home/creative/public_html/wp-settings.php on line 535

Deprecated: Assigning the return value of new by reference is deprecated in /home/creative/public_html/wp-settings.php on line 542

Deprecated: Assigning the return value of new by reference is deprecated in /home/creative/public_html/wp-settings.php on line 578

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/creative/public_html/wp-settings.php on line 18

Warning: Cannot modify header information - headers already sent by (output started at /home/creative/public_html/wp-settings.php:520) in /home/creative/public_html/wp-includes/feed-rss2.php on line 8
Creative Impact http://www.creativeimpact.net Creative Web Development Sat, 02 May 2009 16:49:16 +0000 http://wordpress.org/?v=2.7.1 en hourly 1 Check if a variable exists in JavaScript http://www.creativeimpact.net/check-if-a-variable-exists-in-javascript/ http://www.creativeimpact.net/check-if-a-variable-exists-in-javascript/#comments Sat, 02 May 2009 16:43:18 +0000 admin http://www.creativeimpact.net/?p=5 At times, you might want to check if a variable exists. Here’s how you can do it:

if (typeof VariableName != 'undefined')

where, of course, VariableName is the actual name of your variable.
But what if you know for sure that your variable exists, but you don’t know if it stores a value?
This little Javascript snippet can help:

if (undefined != VariableName)
]]>
http://www.creativeimpact.net/check-if-a-variable-exists-in-javascript/feed/