News for hackers. Stuff that matters.
Re:Ask HN: Will front end development ever move away from Ja... by smonff on Sunday March 12, 2017 @04:33AM (#13849819)
Why would you ever write such a thing?
Re:Ask HN: Will front end development ever move away from Ja... by CognitiveLens on Sunday March 12, 2017 @01:41PM (#13851869)
You wouldn't. The argument is so straw-man that it verges on trolling.
Re:Ask HN: Will front end development ever move away from Ja... by coldtea on Sunday March 12, 2017 @03:49PM (#13852661)
Actually you don't have to write such a thing to get the same BS behavior, and it's not a strawman at all.

It's just a side-product of JS god-broken coercion rules and types, and those affect every statement one writes, down to the suggestion to use === instead of == for the most fundamental thing any language does: equality comparison.

The example is just meant to showcase how far the brokeness can be taken...

Re:Ask HN: Will front end development ever move away from Ja... by kls on Monday March 13, 2017 @09:06PM (#13864086)
Actually I like the ability to == all known ducks. There are a lot of cases that we run into like a DB that we have no control over where they use null, '' or 0 as some form of indicator of no value, it's nice to be able to ignore all of those cases when one does not have control over the quality of data coming in the pipe.

I tend to favor the mantra of be a liberal when consuming data and a conservative when exporting data and I find the == vs === does that very well. Sure it's a gotcha but no big surprise to most people that have been doing JS for any amount of time. I personally think it is a brilliant feature that save a lot of boilerplate when one understands the difference.

Re:Ask HN: Will front end development ever move away from Ja... by krapp on Sunday March 12, 2017 @06:44AM (#13850145)
It's an effective way of obfuscating malware, for one thing.
Re:Ask HN: Will front end development ever move away from Ja... by kwhitefoot on Sunday March 12, 2017 @12:33PM (#13851432)
Surely not. It would be easy to spot.
Re:Ask HN: Will front end development ever move away from Ja... by chc on Sunday March 12, 2017 @01:55PM (#13851959)
Obfuscation doesn't necessarily need to be hard to spot, just hard to understand. Like, could you spot this in a chunk of minified code? Probably. Would you be able to figure out what was going on? Probably not without some difficulty.
Re:Ask HN: Will front end development ever move away from Ja... by kwhitefoot on Sunday March 12, 2017 @03:10PM (#13852431)
If it's hard to understand like that then I would be automatically suspicious of it.