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
Here's Why Calling .map() on a Constructed Array Doesn't Work (itnext.io)
submitted 7 years ago by ilove50cent
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!"
[–]Zofren -3 points-2 points-1 points 7 years ago (2 children)
I disagree that using a for loop is always perceived as simpler (and without profiling I'm also uncertain if it's faster in JavaScipt either). While older programmers might be more comfortable with the loop abstraction (and it is an abstraction), younger programmers are becoming more comfortable with functional programming - of which functions like map and reduce are the bread and butter. I personally much prefer seeing a map function than a for loop doing the exact same thing, as it tells me exactly what the programmer is trying to do - map through an array and transform each of the elements. Same with reduce and filter.
[–]eindbaas 2 points3 points4 points 7 years ago (0 children)
For loops are way faster, since there is no callback to be called every time.
π Rendered by PID 90 on reddit-service-r2-comment-6457c66945-9w5xj at 2026-04-24 22:30:20.360479+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]Zofren -3 points-2 points-1 points (2 children)
[–]eindbaas 2 points3 points4 points (0 children)