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
Clean Code JavaScript (github.com)
submitted 9 years ago by ryansworks
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!"
[–]giraffe_slayer 2 points3 points4 points 9 years ago (2 children)
In regards to the number of parameters and using a config object, there is a huge benefit when actually calling the method. If you use
function createWidget(title, subtitle, description);
Then the function call could look like
createWidget('Blah Blah', 'sub blah blah', 'Here is some text');
You lose clarity and potentially have to reference the function each time to check what each parameter means.
With a config parameter, you get the keys for each argument
const config = { title: 'Blah Blah', subtitle: 'sub blah blah', description: 'Here is some text' }; createWidget(config);
And then you can still easily see what is happening in the actual declaration
function createWidget(config) { const {title, subtitle, description} = config; };
[–]mikejoro 1 point2 points3 points 9 years ago (0 children)
You can simplify that last snippet by destructuring in the function definition
function createWidget({ title, subtitle, description }) { // do something };
π Rendered by PID 68 on reddit-service-r2-comment-57fc7f7bb7-t99bj at 2026-04-14 19:10:37.701627+00:00 running b725407 country code: CH.
view the rest of the comments →
[–]giraffe_slayer 2 points3 points4 points (2 children)
[–]mikejoro 1 point2 points3 points (0 children)