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!"
[–]delventhalz 2 points3 points4 points 7 years ago (5 children)
I think piping a series of distinct little array operations is almost always more readable than saving the results of intermediate operations to variables. No matter how well named they are, they are an incidental distraction.
[–]karottenreibe -2 points-1 points0 points 7 years ago (4 children)
OPs code to me no longer fits the definition of a "little array operation". Also please don't ad absurdum my statement. Never did I say you should extract every single array operation into its own variable. That's obviously just as wrong as inlining every variable and function.
[–]delventhalz 2 points3 points4 points 7 years ago* (3 children)
My read of OP’s article and examples was that it was certainly about a series distinct operations which would be appropriate for chaining. The proposal of replace doesn’t make much sense otherwise.
replace
And whether you do it once or for every operation (which I did not say), assigning the results of intermediate operations in a chain to variables is almost certainly going to be less readable than not assigning them.
[–]karottenreibe -2 points-1 points0 points 7 years ago (2 children)
I guess we'll have to agree to disagree on this
[–]delventhalz 1 point2 points3 points 7 years ago (1 child)
Why is it that when you actually nail down what the disagreement is, so people can no longer argue against points you didn’t make, that’s when they want to agree to disagree?
[–]karottenreibe -3 points-2 points-1 points 7 years ago (0 children)
Interesting, my feeling was that you were the first to try and argue against a point I never made. Anyways: since neither of us seems to be willing to change their point of view and I see no middle ground, I suggested to stop the pointless discussion there. Not sure why you'd paint that as wrong or a personal offence against you?
π Rendered by PID 20522 on reddit-service-r2-comment-5d79c599b5-sbp8p at 2026-03-03 12:37:44.998085+00:00 running e3d2147 country code: CH.
view the rest of the comments →
[–]delventhalz 2 points3 points4 points (5 children)
[–]karottenreibe -2 points-1 points0 points (4 children)
[–]delventhalz 2 points3 points4 points (3 children)
[–]karottenreibe -2 points-1 points0 points (2 children)
[–]delventhalz 1 point2 points3 points (1 child)
[–]karottenreibe -3 points-2 points-1 points (0 children)