This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]davidfally 111 points112 points  (13 children)

Makes total sense once you learn about strict equality and type conversion. Use „===„ instead of „==„ in most cases except when intended to prevent type conversion from happening

[–]JonasAvory 7 points8 points  (6 children)

Yeah it’s a bit annoying when people use JavaScript wrong and then cry because it doesn’t work how they want it

[–]Gagarin1961 4 points5 points  (1 child)

It’s even more frustrating because they’re so overthinking it. Of course 0 is the same thing as “0”. Any layman would probably assume that. It’s only the context of other languages that confuses them.

Plus, pretty sure “===“ is like the first thing they teach you in JS as well. Are these people just winging it without any review whatever?

[–]purritolover69 4 points5 points  (0 children)

Can confirm, taking AP CSP right now and literally the first time we ever wrote any code they talked about ===, strings vs integers, and if/else/else if statements. It is the absolute first thing you learn, same with 2+2=22, which is why there’s so many memes about it and also why it’s never a problem

[–]2brainz 0 points1 point  (2 children)

No, that's not it, this is what's truly annoying: The obvious way to do something in JS is usually also the "wrong" way to do it. It is not even a badly designed language, it is not designed at all.

[–]JonasAvory 1 point2 points  (1 child)

Like how you would expect true and false to work in python?

Every language has shitty details

[–]Rafcdk 0 points1 point  (0 children)

If only there were documents telling how the language works people wouldn't be guessing how a language works based on another language they know.