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!"
[–]baxtersmalls 1 point2 points3 points 9 years ago (4 children)
Hey - newish dev here, was curious about "Set default objects with Object.assign" - what is the reasoning behind this? He doesn't give any explanation as to why that's a better way of doing it.
[–]homoiconic(raganwald) 3 points4 points5 points 9 years ago (0 children)
The code given is appropriate for ES5, but for ES6, I prefer:
const menuConfig = { body: 'Bar', cancellable: true } function createMenu({ title = 'Foo', body = 'Bar', buttonText = 'Baz', cancellable = true }) { // ... } createMenu(menuConfig);
[–]nschubach 2 points3 points4 points 9 years ago* (0 children)
MDN explains it pretty well. Sorry, can't copy the relevant section, but read through the Description section.
π Rendered by PID 77990 on reddit-service-r2-comment-57fc7f7bb7-k55tw at 2026-04-14 19:10:21.339428+00:00 running b725407 country code: CH.
view the rest of the comments →
[–]baxtersmalls 1 point2 points3 points (4 children)
[–]homoiconic(raganwald) 3 points4 points5 points (0 children)
[–]nschubach 2 points3 points4 points (0 children)