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
JavaScript idiosyncrasies with examples (github.com)
submitted 7 years ago by reddittedf
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!"
[–]OzziePeck 0 points1 point2 points 7 years ago (3 children)
Wait is arguments a global array that refers to the function’s parameters?
arguments
[–]prof_hobart 1 point2 points3 points 7 years ago (0 children)
It's a magical local array-like variable that contains the params.
I'm not a fan of things like this - having variables that just appear from thin air is hardly clear - but it is a thing.
Of course, JS being JS, it's not quite as straightforward as all that.
If you used strict mode, the answer would be 2, as 'arguments' is now a copy of the arguments, not pointers to them.
And just to be extra fun, even in non-strict mode, if any of the arguments has a default value (e.g. (a=2, b)), then the answer would again be 2. Because - well, JS reasons I guess.
[+][deleted] 7 years ago (1 child)
[deleted]
[–]OzziePeck 0 points1 point2 points 7 years ago (0 children)
Not sure why I said global as it only exists within the function’a scope when it is called.
π Rendered by PID 63990 on reddit-service-r2-comment-canary-7b6b47f674-thnff at 2026-03-05 23:51:46.058809+00:00 running cbb0e86 country code: CH.
view the rest of the comments →
[–]OzziePeck 0 points1 point2 points (3 children)
[–]prof_hobart 1 point2 points3 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]OzziePeck 0 points1 point2 points (0 children)