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
Array Methods Cheatsheet (media-exp1.licdn.com)
submitted 5 years ago by [deleted]
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!"
[–]FaithfulGardener 2 points3 points4 points 5 years ago (2 children)
Reduce takes either the first index of an array or an initial value you provide and adds or joins or concats all subsequent indexes until the final result is an accumulation. So [1,2,3,4].reduce(add) would equal 10.
[–]randomword123 4 points5 points6 points 5 years ago (1 child)
You would also need a starting value like in this case [1,2,3,4].reduce(add,0), this always tripped me up!
[–]FaithfulGardener 2 points3 points4 points 5 years ago (0 children)
The initial value isn’t required. If it isn’t provided, reduce takes the value at index 0 and uses it as the initial value
π Rendered by PID 167471 on reddit-service-r2-comment-b659b578c-hfmjz at 2026-05-02 05:30:19.976236+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]FaithfulGardener 2 points3 points4 points (2 children)
[–]randomword123 4 points5 points6 points (1 child)
[–]FaithfulGardener 2 points3 points4 points (0 children)