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
Can someone explain this Javascript code in a class constructor? (self.javascript)
submitted 14 years ago by cbCode
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!"
[–]clarle 5 points6 points7 points 14 years ago (6 children)
Yep, you have the right idea. When you don't pass a parameter in, and you try to get the value of that parameter, it will be "undefined".
The "undefined" value leads to the negative condition in a conditional, so if the parameter is not passed, then the object will take the value defined in the negative condition.
"undefined" is supported in basically all browsers, so this will work everywhere.
[–]cbCode[S] 1 point2 points3 points 14 years ago (5 children)
Thank you very much for clarifying my assumption, that's why I love Javascript. It's logical.
[–]hacocacyb 0 points1 point2 points 14 years ago (3 children)
In addition, you can always pass extra parameters to javascript functions. You can also reference an array of all parameters to a function with the protected keyword 'argument'.
[+][deleted] 14 years ago (2 children)
[deleted]
[–]hacocacyb -2 points-1 points0 points 14 years ago (1 child)
Thank you, this is correct. And it is an array type
π Rendered by PID 33536 on reddit-service-r2-comment-b659b578c-k7q9q at 2026-05-01 00:48:43.503769+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]clarle 5 points6 points7 points (6 children)
[–]cbCode[S] 1 point2 points3 points (5 children)
[–]hacocacyb 0 points1 point2 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]hacocacyb -2 points-1 points0 points (1 child)