[Javascript] typeof

TomMallard mallard at serv.net
Thu May 17 07:38:46 CDT 2001


Just realized I labeled them bassackwards...

if(nameID == 'undefined' || nameID == ''){
    // empty
}else{
    // OK
}

tom
----- Original Message -----
From: "TomMallard" <mallard at serv.net>
To: <javascript at LaTech.edu>
Sent: Wednesday, May 16, 2001 10:28 PM
Subject: Re: [Javascript] typeof


> if(nameID == 'undefined' || nameID == ''){
>     // valid nameID
> }else{
>     // empty
> }
>
> tom
> ----- Original Message -----
> From: "Andrew Dunn" <adunn at interworx.com.au>
> To: <javascript at LaTech.edu>
> Sent: Wednesday, May 16, 2001 9:53 PM
> Subject: [Javascript] typeof
>
>
> > Hi,
> >    I have a variable called nameID. This variable holds the name of
> another
> > variable which is an array. Sometimes the variable that is held in
nameID
> is
> > non-exsistent ie. "undefined". How can I test this?
> >
> > I've tried typeof(eval(nameID))) but that returns "object". I need a way
> to
> > see whether the variable that is held in nameID is exsistent. Can anyone
> > help me?
> >
> > Thank you.
> >
> > Andrew Dunn.
> >
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> http://www.LaTech.edu/mailman/listinfo/javascript
>





More information about the Javascript mailing list