In comp.lang.javascript message <93*****************@newssvr11.news.prod
igy.net>, Fri, 9 Feb 2007 03:40:53, pcx99 <x@x.composted:
>ironically the way is to use the "undefined" keyword which javascript
uses to indicate that a variable doesn't technically exist yet.
No.
If a variable exists, it must have a value. The default value is of the
undefined type, which has one value which is undefined - not the same as
the string "undefined" of course.
If a variable does not exist, its contents don't exist and cannot be
tested. One can test to see whether a variable exists, using !!,
provided (AFAIR) that it cannot have the values +0, -0, false, "", null,
or undefined. One can I think do better with window.onerror. One may
be able to do better with try...except.
Then there's the "strict equality" operator ...
Once a variable has been created and assigned an "ordinary" value, such
as 3 or "Fred" or tomorrow-lunchtime, it can have the value undefined
assigned to it.
Calling it undefined was very silly, since it is then difficult to talk
about it. It should have been called bogus, which has the merit of
being shorter than a standard tab. Or unecht.
It's a good idea to read the newsgroup and its FAQ. See below.
--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.