News for hackers. Stuff that matters.
Re:A one-second video taken by the Rosetta probe on the surf... by tenaciousDaniel on Wednesday April 25, 2018 @07:56AM (#16920668)
JS is poorly understood in comparison

This might be the most hilariously ridiculous true statement I've ever heard.

Re:A one-second video taken by the Rosetta probe on the surf... by Tepix on Wednesday April 25, 2018 @08:14AM (#16920774)
In javascript:

x == x _ is true. Good.

x == !x _ is also true. Oops?

And guess what:

Array(3)==",," _ is also true.

But

NaN == NaN _ is false.

Math.max()>Math.min() _ is also false!

but then again

Math.max()<Math.min() _ is true.

Madness, I tell you!

Re:A one-second video taken by the Rosetta probe on the surf... by scott_s on Wednesday April 25, 2018 @10:14AM (#16921670)
NaN not being equal to itself is true in all languages with IEEE compliance: https://en.wikipedia.org/wiki/NaN
Re:A one-second video taken by the Rosetta probe on the surf... by conistonwater on Wednesday April 25, 2018 @10:58AM (#16922072)
Nitpick: NaN is supposed to work like that: the rule is that every comparison of any value against NaN returns false.
Re:A one-second video taken by the Rosetta probe on the surf... by bjoli on Wednesday April 25, 2018 @08:47AM (#16920995)
I just looked at the famous left-pad for the fastest way o implementing a pad function in JS.

I asked a friend that does web dev and it is apparently pretty idiomatic JS. Pretty appalling. I finally understood why people claimed it was "hard to get right".

Re:A one-second video taken by the Rosetta probe on the surf... by SkyMarshal on Wednesday April 25, 2018 @10:44PM (#16928397)
Re:A one-second video taken by the Rosetta probe on the surf... by sixothree on Wednesday April 25, 2018 @11:32AM (#16922456)
At least x === x, right?
Re:A one-second video taken by the Rosetta probe on the surf... by dak1 on Wednesday April 25, 2018 @01:00PM (#16923562)
const x = NaN;

x === x; // false

Re:A one-second video taken by the Rosetta probe on the surf... by joezydeco on Wednesday April 25, 2018 @01:13PM (#16923715)
But they're close to getting two numbers to add together!

https://twitter.com/thomasfuchs/status/933447631514169344

Re:A one-second video taken by the Rosetta probe on the surf... by sandebert on Thursday April 26, 2018 @01:30AM (#16929067)
They should use jQuery for that. I hear it's good for all the things.