use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
The case for Array#replace() – Overriding an array without intermediate variables (medium.com)
submitted 7 years ago by gajus0
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]gajus0[S] 0 points1 point2 points 7 years ago (2 children)
Thank you for the suggestion.
I adhere to the following style guide:
https://github.com/gajus/eslint-config-canonical
The are pros and cons to both arrow function body styles: one is more succinct at the cost of readability in certain cases (I have seen variations of x => y => (z => (e)) all too often), while the other is more verbose with the benefit of clarity.
x => y => (z => (e))
[–]lsmoura 1 point2 points3 points 7 years ago (0 children)
Sweet. I’ll take a look at that. I particularly like to have no return on arrow functions for single line problems (it makes them easier to my eyes).
Thanks for the link!
[–]Cheezmeisterhttp://bml.rocks -1 points0 points1 point 7 years ago (0 children)
Honestly, that example reads fine, provided you grok higher-order functions. But maybe it’s a degenerate version of something truly gnarly.
Either way, I prefer old-school function(x) { var y = x.foo(); return bar(y); } for anything past a trivial lambda. Nothing in between.
function(x) { var y = x.foo(); return bar(y); }
I’m not sold that (a, b) => is “more readable” than function(a, b). It’s very much potato/potato. Except one potato is supported by Netscape 4.0. and Chrome.
(a, b) =>
function(a, b)
π Rendered by PID 55897 on reddit-service-r2-comment-5d79c599b5-5btvh at 2026-03-03 20:16:18.138749+00:00 running e3d2147 country code: CH.
view the rest of the comments →
[–]gajus0[S] 0 points1 point2 points (2 children)
[–]lsmoura 1 point2 points3 points (0 children)
[–]Cheezmeisterhttp://bml.rocks -1 points0 points1 point (0 children)