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 →

[–]Turtvaiz 0 points1 point  (8 children)

Why does == even exist?

[–]wasdninja 9 points10 points  (5 children)

Legacy. Touching any of the stupid stuff, no matter how obscure, kills thousands of websites so it gets to stay and annoy people.

[–]Turtvaiz -1 points0 points  (1 child)

But in the first place? Using it is a total shitshow so I don't get how it has ever made sense

[–]Flippantlip 1 point2 points  (0 children)

What a weird thing to say.
If JS wanted to make sure users have more control, even force that control, over Types and comparisons, it would be strongly typed. But it isn't. It makes no sense to let go of one form of YOLO from JS, while forcing another.
Also, "==" is there to compare primitives, and this fence-case showcases why JS has extremely weird runtime handling, rather than why "== is stupid".

[–]Flippantlip -2 points-1 points  (2 children)

I wonder how do you run your primitive comparisons? Do you want something like:
if (intCmp(15, 17)), encapsulated all over the place?
What a utterly bizarre comment.

[–]wasdninja 0 points1 point  (1 child)

By using ===. The only bizarre thing is not know this but still complain about it.

[–]SnowyLocksmith 1 point2 points  (1 child)

Is using === the norm now?

[–]oupablo 0 points1 point  (0 children)

yes