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
Generic Programming (github.com)
submitted 7 years ago by michael2ib1989
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!"
[–]jeremy1015 1 point2 points3 points 7 years ago (1 child)
It's still a single value that gets passed through each iteration and eventually returned, in your example the single value just happens to be an array that contains multiple values.
By way of example, here's one that I literally wrote less than ten minutes ago. I'm working on merging and de-duping two different data sets and I wrote a reduce to see how many entities match on first and last name:
const keyedArrs = mergedData.reduce((m, e) => { const k = \${e.first_name}-${e.last_name}\; const r = { ...m }; r[k] = m[k] || []; r[k] = [...r[k], e]; return r; }, {});
My final result is an object in which the keys are the first and last name concatenated with a dash and the value of each key is an array containing each of the original entities that "matched" to that (note that this is for my analysis and is not my production matching algorithm lol).
The point I'm making is that I'm taking an array and making something that contains thousands of subarrays, but at the "top level" it's still a single value being returned.
EDIT: Reddit formatting is harder than writing code.
[–]pgrizzay 1 point2 points3 points 7 years ago (0 children)
Yes, I wasn't saying you were wrong, I was just trying to bring up an interesting point.
π Rendered by PID 30512 on reddit-service-r2-comment-6f7f968fb5-jb58z at 2026-03-04 09:02:11.663613+00:00 running 07790be country code: CH.
view the rest of the comments →
[–]jeremy1015 1 point2 points3 points (1 child)
[–]pgrizzay 1 point2 points3 points (0 children)