How exactly is this educational?
How exactly is this educational?
In order to get particular characters (for example: f), the script uses "false"[0], where "false" is derived from adding ![] + [], and 0 is derived from +[].
Putting all of that together ($ node):
> (![]+[])[+[]]
'f'
Here's some better examples of JS oddities: http://stackoverflow.com/q/9032856/1538708
> []["filter"]["constructor"]("alert(1)")()
The comparable IOCCC.org contest is a great place to learn C: sure the primary focus is making obfuscated code, and the audience marvels at the bizarreness thereof, but taking the time to pick a submission apart and figure out why it works (despite a host of reasons why you'd think it shouldn't) expands your understanding of the language.
It's a great way to improve your language skills when you've reached the initial "I know language X" confidence.