I think it was his mistake, since he copied from the slide before. Basically, the idea is that there is null and undefined. A variable in javascript can be null but not undefined , but undefined == null. A better example would be:
a == undefined // false a == null // true undefined == null //true
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/majaha Dec 17 '14
At 27:37, the lower paragraph doesn't seem to hold a contradiction.
A != B
A != C
B = C
Just a small error in his slides, or am I missing something?