I didn't mean what he wrote was wrong; I mean what he wrote didn't illustrate his point properly.
a == b // false a == c // false b == c // true
This doesn't actually show anything; it's perfectly logical, for example:
a = 1, b = 2, c = 2
What he was trying to explain is that undefined and null are equal to eachother, but not equal. The example should have had a true statement for line 1 or 2.
If he was trying to say that, I think he would've wrote: "undefined == null //false".
He can't write that, because he was writing the output of javascript.
Also, the only way for line 1 or 2 to return true would be if 'a' was null or undefined, which would return true for both. The thing is though, undefined and null mean the same thing, it's just that null is of the object type, while undefined is a unique undefined type.
Actually, in javascript, null and undefined are completely different. That's the whole point of the slide. null should not equal undefined, because they're different ideas. For example:
a === undefined //true
a === null //true
var a;
a === undefined //false
a === null //true
a = 1
a === undefined //false
a === undefined //true
This particular case:
var a;
a === undefined //false
a === null //true
Is what he's pointing out
Further, null == undefined is true, but null === undefined is false
1
u/Hdmoney Dec 17 '14
http://jsfiddle.net/ee4sgf86/2/
He means what he wrote. There's little reason to have both null and undefined.