[Javascript] Testing for "undefined" (undefined vs. null)

Andrew adunn at mail.interworx.com.au
Thu Jun 7 11:11:22 CDT 2001


Use typeof("variable")

eg. if (typeof(top.frames) = "undefined") return;


----- Original Message ----- 
From: "Craig Michael Nathan" <cnathan at MEconomy.com>
To: <javascript at LaTech.edu>
Sent: Thursday, June 07, 2001 2:01 PM
Subject: [Javascript] Testing for "undefined" (undefined vs. null)


> I have a wacky problem in that using 
> top.frames
> sometimes returns "undefined".
> 
> I'm curious how I can test for "undefined".
> 
> I tried:
> if (top.frames == null) return;
> 
> But have since learned that null != undefined
> 
> Any ideas?
> 
> Much appreciated,
> 
> -Craig
> 
> 
> *****************************
> Craig Michael Nathan
> Chief Technology Officer
> MEconomy, Inc.
> cnathan at MEconomy.com
> 
> PGP [4096]: 
>   7312 ec39 3e1b 9a48 8cc5
>   bd9b 8645 4af4 9c23 0b73
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> http://www.LaTech.edu/mailman/listinfo/javascript
> 





More information about the Javascript mailing list