News for hackers. Stuff that matters.
Re:JavaScript Equality Minesweeper by thalesmello on Monday September 17, 2018 @02:12PM (#18008388)
> 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/).

There you have your JS ninja trick to handle two distinct null types^TM .

Re:JavaScript Equality Minesweeper by simias on Monday September 17, 2018 @06:38PM (#18010731)
I 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.
Re:JavaScript Equality Minesweeper by thalesmello on Monday September 17, 2018 @07:01PM (#18010865)
Just 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.