6 ms·
You'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 perfec
by simias 8y ago
You'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.