3 ms·
>> "JS is an ugly language" What I meant: > "JS is an ugly language, with way too many pitfalls." IMHO it's ugly from 'within', just look at the JS truth tab
by trymas 11y ago
>> "JS is an ugly language"
What I meant:
> "JS is an ugly language, with way too many pitfalls."
IMHO it's ugly from 'within', just look at the JS truth table [1] and video I linked with the quote [2]. I just feel that I have no control of what I am doing with JS.
<rant>
It's quite a paradox, that new people to programming, can get start quick with JS, though are not repelled how easily you can shoot yourself in the foot with it. But maybe they just do not catch the errors..
</rant>
[1] https://dorey.github.io/JavaScript-Equality-Table/ https://dorey.github.io/JavaScript-Equality-Table/
[2] https://www.youtube.com/watch?v=20BySC_6HyY https://www.youtube.com/watch?v=20BySC_6HyY
- insin 11y agoThe link you provided to demonstrate the problem also gives you the solution: > Moral of the story: > > Always use 3 equals unless you have a good reason to use 2. Tools like ESLint make it easy to enforce this (and to only allow == in the few cases where those good reasons apply).
- trymas 11y agoI think we are getting into deep rant, though I want to say, that even I know this rule of JS (always use 3 equals, unless you know why you need 2) why not make double equal work as triple one?
- mkishi 11y agoIf we were to rewrite history, that'd probably happen. Now count the number of languages that wouldn't reconsider something if we were able to.. I understand your frustration with js, but let's not pretend it's objectively worse to learn to deal with its pitfalls instead of other languages'.
- untog 11y agoBecause JS makes a point of being backwards compatible. Which is great, because some people out there are still using IE6.