Subj : Re: undefined variables To : netscape.public.mozilla.jseng From : Brendan Eich Date : Wed Aug 25 2004 08:18 am Igor Bukanov wrote: > Stuart wrote: > >> Hi, >> >> I am a little confused as to the use of undefined in javascript and >> Rhino. >> >> I think my fundamental problem is that I do not understand the purpose of >> having both an Undefined and Null type/value in ECMAScript. > > > I suggest to post a generic question about that topic to the newsgroup > so perhaps SpiderMonkey folks could tell the story. The undefined value is the initial value of properties created without any other value, and the value returned when you access a property by a qualified expression (e.g., obj.prop, not prop) and no such property exists in the object (meaning directly in the object, or indirectly in an object on its prototype chain). The null value is different, and connotes "no object" or "null reference". It's occasionally useful to have a distinct value for these connotations from the undefined value, but note that null == undefined (and vice versa; == is reflexive and symmetric but not transitive; of course, as you would hope, null !== undefined). /be .