View Single Post
  #3 (permalink)  
Old June 14th, 2005, 06:40 AM
ChrisScott ChrisScott is offline
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

You can use typeof...
Code:
if(typeof myVar == "undefined"){
    // variable is undefined, do something 
}
However typeof will return "undefined" if a variable has not been set to any value / object / etc., so var myVar; would return "undefined" and var myVar = null; would not.

HTH,

Chris

Reply With Quote