4 ms·
> it seems equality operator in javascript is good for nothing but being a source of confusion and a target of jokes. I would say that's the defining character
by paradite 8y ago
> it seems equality operator in javascript is good for nothing but being a source of confusion and a target of jokes.
I would say that's the defining characteristics of JavaScript.
It makes it fun to write JavaScript with its quirkiness and "dynamic" nature. And once you master it you become a ninja.
Compare it to Java or Golang where you are restricted by the language syntax and anything slightly creative and fun is either not supported or not idiomatic.
- keymone 8y ago> It makes it fun to write JavaScript with its quirkiness and "dynamic" nature. nope. none of that. there are plenty of fun, dynamic languages that aren't the horrible pile of shit that is raw javascript. > And once you master it you become a ninja. wait, was this sarcasm? hard to tell..
- simias 8y agoYou'll have to show me one inventive and useful "ninja" trick revolving around the use of '=='. Sounds to me like the classic "my programming language is perfect and if you don't like it you're just too dumb to get it". This is pretty common among C developers in my experience but I didn't expect that from JS enthusiasts. What's next, PHP ninjas?
- paradite 8y ago>You'll have to show me one inventive and useful "ninja" trick revolving around the use of '=='. 1. I was making a generalized statement around JS, not specifically '=='. That's a misinterpretation of my statement. >"my programming language is perfect" 2. I did not say JavaScript is perfect. That's a misinterpretation of my statement. >"if you don't like it you're just too dumb to get it" 3. I did not say "if you don't like you're just too dumb." That's a misinterpretation of my statement.
- thebuzzsaw 8y agoDid you stop to consider that maybe you conveyed these ideas regardless of whether you meant to? JavaScript really _isn't_ all that expressive.
- paradite 8y agoI tried my best, but I can't control how other people interpret it. That's what comments are for after all, to deal with information asymmetry like this. I just don't get it. What's wrong with expressing my love for a language that I love? I am not even asking for anyone to switch to JS, just expressing my feel.
- keymone 8y agowhat's wrong with people disagreeing with you? isn't that what comments are (partly) for?
- paradite 8y agoYes. Maybe I am too conscious of people disagreeing with each other. It's actually very normal. Thanks for pointing that out. I think might be due to the downvotes somehow. It makes you wonder if you did something wrongly or it is simply people disagreeing with you.
- thalesmello 8y ago> You'll have to show me one inventive and useful "ninja" trick revolving around the use of '==' Sure! For starters, you can write if (foo == null) { ... } Because `undefined` gets coerced to `null`, it saves you from writing: if (foo === null || foo === undefined) { ... } And, because it's shorter, it's even allowed by [some JS linters](https://standardjs.com/ https://standardjs.com/). There you have your JS ninja trick to handle two distinct null types^TM .
- simias 8y agoI would argue that it's only a "feature" because JS has this needless dichotomy between null and undefined so it's basically two issues cancelling each-other, but that sounds a lot like moving the goalpost so I'll concede the point.
- thalesmello 8y agoJust to make sure, my "ninja trick" was meant in an ironic manner. In my opinion, it sucks JavaScript has two equality operators, and it's inexcusable for it to have two different null types. That fact that you can use the forer to check for the latter with less code doesn't make either okay in any sense.
- matthewmacleod 8y agoHonestly… The last thing I want in most of my code is "creativity" and "fun".
- paradite 8y agoWell then, your life, your choice.
- matthewmacleod 8y agoSure, until I end up working on someone else’s codebase, and have to clean up the “fun” and “creative” code they thought would be a better idea than “simple,” “idiomatic,” and “explicit”!
- flavio81 8y ago>It makes it fun to write JavaScript with its quirkiness and "dynamic" nature. And once you master it you become a ninja. Yes, a ninja of the "undefined is not a function" wars.
- Sohcahtoa82 8y ago> slightly creative and fun In my experience, code that is "slightly creative and fun" is unreadable and not actually useful for creating working products as a part of a team.
- paradite 8y agoDo you mean you prefer to just follow instructions given by product managers as a robot rather than exercising your creativity and enjoy coding? Or am I reading your statement wrongly? That sounds like a terrible job to have.
- Sohcahtoa82 8y agoI'm interpreting "creative and fun" as either synonymous with "overly clever" (which is hard to read, hard to debug, and hard to maintain [0][1]), or written a non-standard way just for the sake of being different. For example, here's a collection of FizzBuzz solutions[2]. Most of these are incredibly unreadable. [0]https://www.simplethread.com/dont-be-clever/ https://www.simplethread.com/dont-be-clever/ [1]http://www.delabs.io/clever-code-is-bad-code/ http://www.delabs.io/clever-code-is-bad-code/ [2]https://ditam.github.io/posts/fizzbuzz/ https://ditam.github.io/posts/fizzbuzz/
- ghrifter 8y agoT. I don't understand static vs dynamic typing