top | item 924218 (no title) youngnh | 16 years ago I actually did a === check for just that reason, since if you define _ = {}, then passing in a real object that is {} will also return true for _ == {} discuss order hn newest tlrobinson|16 years ago Nope: js> a = {} [object Object] js> b = {} [object Object] js> a == b false == only casts between certain primitive types, it doesn't do a deep comparison: js> x = null null js> y = undefined js> x == y true js> x === y false Also undefined comparisons are still true with ===: js> var _ js> _ === undefined true But you're right, === should be the default choice, and only use == if you have a good reason.
tlrobinson|16 years ago Nope: js> a = {} [object Object] js> b = {} [object Object] js> a == b false == only casts between certain primitive types, it doesn't do a deep comparison: js> x = null null js> y = undefined js> x == y true js> x === y false Also undefined comparisons are still true with ===: js> var _ js> _ === undefined true But you're right, === should be the default choice, and only use == if you have a good reason.
tlrobinson|16 years ago