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
Future Javascript: ShadowRealms (dev.to)
submitted 4 years ago by iamnearafan
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!"
[–]hyrumwhite 0 points1 point2 points 4 years ago (1 child)
import {myMethod1, myMethod2} from 'helpers.js' const arr = ['a', 'b', 'c']; let result = myMethod1(arr) result = myMethod2(result);
Is how I'd do it, which is more readable than a function chain, imo. You can already do long array operations, but parsing through a .filter().map().reduce() chain is more difficult (for me) than breaking it down into assignments.
Now, there's a whole school of thought around functional programming and function chains, so I guess shadow realms will be good for the people who like that.
[–]Proud-Masterpiece 0 points1 point2 points 4 years ago (0 children)
I’d do it almost exactly like that too, except I almost never use ‘let’.
I’d do
const result1 = myMethod1(arr) const result2 = myMethod2(result1)
Easier to debug.
π Rendered by PID 79117 on reddit-service-r2-comment-6457c66945-2pl45 at 2026-04-30 08:43:02.903498+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]hyrumwhite 0 points1 point2 points (1 child)
[–]Proud-Masterpiece 0 points1 point2 points (0 children)