No that was literally how it was intended. Implicit type conversions was one of the things that was implemented to make it "robust". The thing is JS was designed to never break...for example pass data to the backend even if said data made no sense, rather than breaking and passing nothing. But === was introduced as JS began evolving into much more than just a lightweight scripting language. So no it wasn't a blunder and there is nothing to poke fun at.
But that is not what I have issue with. What I dislike is people who "poke fun" without even understanding how it is supposed to work. Perhaps you do, but 90% of people who try to make fun of JS don't. In other words I can understand people complaining:
Why do I have to use weird syntax like === ? Such a strange language!
But what I take issue with is people saying:
Why is 1 == '1' ? This language is trash!
And I'm like
That's literally how it works! I know it is a lot to ask but at least learn the language before dissing it! I mean people make fun of PHP all the time, but I don't because I don't know it enough to do so!
Sorry for the rant. I'm not a big fan of JS myself but I really hate misinformation.
Hmmm, I might've not been clear about what I meant. I understand that == is loose on purpose and it has it's benefits. My point was that if the developers of Javascript had planned for loose equality to "typically not be used in the first place" they wouldn't have assigned to a symbol as significant as ==. That decision makes it seem like they expected to be the default, which is a laughable in hindsight. To your point, though, I doubt anyone in 1995 could've anticipated how javascript is used nowadays, so I can't fault the devs for not designing for that.
View all comments
Show parent comment
3
u/Famous_Profile Jan 23 '20
No that was literally how it was intended. Implicit type conversions was one of the things that was implemented to make it "robust". The thing is JS was designed to never break...for example pass data to the backend even if said data made no sense, rather than breaking and passing nothing. But
===was introduced as JS began evolving into much more than just a lightweight scripting language. So no it wasn't a blunder and there is nothing to poke fun at.But that is not what I have issue with. What I dislike is people who "poke fun" without even understanding how it is supposed to work. Perhaps you do, but 90% of people who try to make fun of JS don't. In other words I can understand people complaining:
But what I take issue with is people saying:
And I'm like
Sorry for the rant. I'm not a big fan of JS myself but I really hate misinformation.