From: Software I. gn-d. <gn-...@so...> - 2008-10-10 02:03:51
|
Ste...@ga... wrote: > Flanagan states "undefined is returned when you use either a variable that > has been declared but never had a value assigned to it or an object property > that does not exist" - (5th ed.) > > How will your solution behave if for some reason this.north is assigned null? Haven't tried it. Flanagan (5th ed.) says on p. 67 in the discussion of the rules for the == operator: -- If one value is null and the other is undefined, they are equal. So maybe testing equality (or non-equality) against null and against undefined behave (or, should behave) identically? Note, === would behave differently from == here; === is the "real" comparison operator. (But the comparison operator should be =, not == or ===. Sigh.) Assuming Flanagan accurately represents how JS works -- and I have no reason to doubt that -- I'd say his book is a rich resource if you're looking for six impossible things to believe before breakfast. -- Richard Walker Software Improvements Pty Ltd Phone: +61 2 6273 2055 Fax: +61 2 6273 2082 |