News for hackers. Stuff that matters.
Re:Ask HN: Will front end development ever move away from Ja... by pjmlp on Sunday March 12, 2017 @03:02AM (#13849551)
We hate JavaScript, because writing the code below is a perfect valid way of calling alert(1).

    [][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+[+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+ [])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]])()
Re:Ask HN: Will front end development ever move away from Ja... by jaredsohn on Sunday March 12, 2017 @03:04AM (#13849560)
That's a feature if most of the keys on your keyboard are broken. :)

Seriously, it is not a good reason. Just don't write code like this nor allow other people in your team to write code like this. Fortunately, this kind of code is unlikely to be written by mistake so it is easily avoidable.

Re:Ask HN: Will front end development ever move away from Ja... by pjmlp on Sunday March 12, 2017 @03:19AM (#13849616)
That was just one example, there are lots of other WATs.

As for team, in enterprise consulting, the concept of team is very shallow.

Re:Ask HN: Will front end development ever move away from Ja... by scriptproof on Sunday March 12, 2017 @11:21AM (#13851040)
I initially believed it was a sarcasm!
Re:Ask HN: Will front end development ever move away from Ja... by lazerwalker on Sunday March 12, 2017 @03:24PM (#13852511)
Are you familiar with Gary Bernhardt's talk "Wat"? (https://www.destroyallsoftware.com/talks/wat)

I don't think it's that productive to judge a language on the worst features and edge cases that most teams will be able to easily reach consensus on avoiding, as every language will have its bullshit.

Re:Ask HN: Will front end development ever move away from Ja... by coldtea on Sunday March 12, 2017 @03:46PM (#13852650)
>I don't think it's that productive to judge a language on the worst features and edge cases that most teams will be able to easily reach consensus on avoiding

Only those edge cases merely expose functionality that can burn programmers on an everyday basis, like coercion rules.

It's not something that you have to get out of your way to get.

Re:Ask HN: Will front end development ever move away from Ja... by chrisfosterelli on Sunday March 12, 2017 @02:03PM (#13852022)
These same obfuscations exist in many, many other languages.
Re:Ask HN: Will front end development ever move away from Ja... by steego on Sunday March 12, 2017 @03:10PM (#13852437)
I imagine they hate those other languages too.

You do know there are many, many languages where that sort of obfuscation lay between difficult to impossible, right?

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.