[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: Re: kjs: about if(undefvar)...
From: Harri Porten <porten () kde ! org>
Date: 2003-01-11 15:28:35
[Download RAW message or body]
On Sat, 11 Jan 2003, Koos Vriezen wrote:
> eval("if (xxx) alert('defined'); else alert('undefined');");
> has changed. It now throws an exception (used to be 'false' iirc). Is that
> correct behaviour?
Yes. The behaviour is correct as I see it. It's a consequence of fixing
the Windows object after David and me believe to finally understand why
if (xxx)
var xxx = 0;
works. The difference to your case: the variable *is* declared. Order of
declaration doesn't matter.
> (I need to change the js code in netscape.javascript.JSObject if so) >
How about the following check:
if (window.xxx) {
....
}
The direct check can be made without risking an exception.
Harri.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic