Subj : Re: undefined values To : netscape.public.mozilla.jseng From : Martin Honnen Date : Tue Aug 05 2003 03:02 pm Matthias Thiel wrote: > Hi, > > is there a possibility to check, whether a variable is defined or not > (using SpiderMonkey) ? > I tried out scripts like "x==undefined", but I got an error instead of true or false. > With Rhino, such scripts are working and returning true or false. Is it a feature of Rhino ? The usual check is if (typeof x == 'undefined') However this doesn't allow you to distinguish the case where the variable is not defined at all and the case where the variable is defined with var x; but not initialized. -- Martin Honnen http://JavaScript.FAQTs.com/ .