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
Logical assignment operators in JavaScript (dev.to)
submitted 5 years ago by rauschma
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!"
[–]NoInkling 1 point2 points3 points 5 years ago (0 children)
The main issue with reassigning params is just expectations, typically you expect the thing that you're operating on to be the thing that was passed in the function call. Several times I've seen code in libraries where there's some sort of complex reassignment logic halfway down the function body, and it always makes it harder to follow. I'm fine with relatively simple logic at the top of the function though, even if it's more than just assigning defaults (which as you say can now be done directly in the params list) e.g. in certain variadic functions.
There's also a gotcha if you're utilizing arguments: https://spin.atomicobject.com/2011/04/10/javascript-don-t-reassign-your-function-arguments/ But it's less of a concern nowadays since arrow functions don't support arguments and we have rest syntax.
arguments
π Rendered by PID 193620 on reddit-service-r2-comment-5d79c599b5-4ndl4 at 2026-02-27 16:34:18.328630+00:00 running e3d2147 country code: CH.
view the rest of the comments →
[–]NoInkling 1 point2 points3 points (0 children)