Re:Implement arrow functions in v8
by AshleysBrain on Thursday June 18, 2015 @12:39PM
(#9739810)
Who on earth would really write that? Surely you'd use the optional braces to make it clearer:
Sure you can write it without that, but only if you want to write willfully unclear code to annoy people, like writing an entire function body on one line. Just because you can do that doesn't mean that functions are inherently unclear.
[ Parent
| on HN ]
More who on earth would really write a function that took a named argument, ignored it, and compared a value in the outer scope.
All of the examples that look confusing are artificially simple and doing things you wouldn't normally try to do.
Re:Implement arrow functions in v8
by andrewstuart2 on Thursday June 18, 2015 @12:58PM
(#9739982)
Well, anybody who wants to use lambdas I'd imagine.
If you're going to write it out, you might as well just add the `function` keyword for clarity because you're not saving a ton of keystrokes.
function(a) { return b <= 7; }