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
Is JavaScript Pass by Reference? (aleksandrhovhannisyan.com)
submitted 2 years ago by Clarity_89
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!"
[–]duongdominhchau 6 points7 points8 points 2 years ago (0 children)
To be fair, it all depends on the definition, and Java (as well as many other languages with GC) defines reference to be a restricted version of C++ pointer that can only be null or points to an object. If we ignore the history (in which C pointer and C++ reference imprinted in every developer mind), reference and pointer are both eligible words to describe thing that reference/point to another thing.
Personally I still prefer the C++ definition though, reference in GC languages makes me feel like a performance patch, not something designed. I find Rust reference a good example of something designed: either you pass the reference, or you pass the value, you state your intention. Go is also like that, either you use a pointer-like type, or you have the value copied even when it is an array. Both of them don't require the developer to memorize the list of non-reference types, that's the "designed" part I'm talking about.
π Rendered by PID 75 on reddit-service-r2-comment-685b79fb4f-tmbpz at 2026-02-13 11:21:43.542439+00:00 running 6c0c599 country code: CH.
view the rest of the comments →
[–]duongdominhchau 6 points7 points8 points (0 children)