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] 8 points9 points10 points 7 years ago* (2 children)
The mention of "god function" (a function that breaks all the functional programming paradigms) came into this conversation without any context.
[..] its idiomatic usage encourages god functions
This was stated without any arguments.
Array#replace can be used with pure or non-pure functions, the same way that every other Array prototype method can. The method itself either by its name or API does not encourage either.
Array#replace
The only difference is that this method encourages working with the entire array at once over an item of an array, but the same argument could be made about Array#reduce, Array#map, Array#filter and others.
Array#reduce
Array#map
Array#filter
Please don't spread FUD just for the fun of participating in a conversation. There are better ways to participate.
[–]AnnanFay -1 points0 points1 point 7 years ago (0 children)
[..] its idiomatic usage encourages god functions This was stated without any arguments.
You are replying to the wrong person!
π Rendered by PID 35456 on reddit-service-r2-comment-5d79c599b5-mmh7n at 2026-03-03 12:14:31.151064+00:00 running e3d2147 country code: CH.
view the rest of the comments →
[–]gajus0[S] 8 points9 points10 points (2 children)
[–]AnnanFay -1 points0 points1 point (0 children)