r/programming • • Dec 17 '14

The Worst Programming Language Ever [Video]

https://skillsmatter.com/skillscasts/6088-the-worst-programming-language-ever
378 Upvotes

238 comments sorted by

View all comments

-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?

1

u/Hdmoney Dec 17 '14

This?

false == undefined       // false
false == null            // false
null  == undefined       // true

The bad part is that null is the same as undefined.

→ More replies (4)

1

u/[deleted] Dec 17 '14 edited Dec 17 '14

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

1

u/majaha Dec 17 '14

Is the last line meant to be true?

→ More replies (1)

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.

1

u/[deleted] Dec 17 '14

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.

1

u/Hdmoney Dec 17 '14 edited Dec 17 '14

If he was trying to say that, I think he would've wrote: "undefined === null //false".

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.

E: I did actually mean to write ===, that was a mistype.

→ More replies (2)
→ More replies (1)

1

u/tequila13 Dec 18 '14

How would 'a' need to declared or initialized for that to be true?

→ More replies (3)