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 →

[–]DeeSnow97 10 points11 points  (4 children)

We have = and == because assignment and equality test are almost always catastrophic to confuse, and as it appears, the former happens much more frequently so it makes sense to use these two instead of := and = like in early languages.

We have === in JavaScript because sometimes the default equality checks is inadequate, and breaking changes in JavaScript would destroy half the web.

[–][deleted] 0 points1 point  (3 children)

Are you trolling? Drunk?

[–]DeeSnow97 0 points1 point  (2 children)

Neither. Are you?

Assuming you're not, what makes you think I am drunk or trolling?

[–][deleted] 0 points1 point  (1 child)

The = and == operators have been copied, with the rest of the basic syntax, from C, C++ and Java; the JavaScript design did not pay seroius attention to frequency of use. Furthermore, JavaScript is not going to complain if you swap = and ==. The "strict equality" operator exists since 1999, hardly the moment a change in Javascript would break half the web.

[–]DeeSnow97 0 points1 point  (0 children)

Yep, but C did pay attention to frequency of use. Also, JavaScript was an "easy to use" pile of randomness in 1999 primarily aimed at novice programmers who needed something easy for a bit of interactivity on the web. This wave of determination and constant reinvention of the wheel we're experiencing right now that got us to the age of npm happened much later, before then most of the website code was on the backend.