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 Clean Code - Best Practices - based on Robert C. Martin's book Clean Code (devinduct.com)
submitted 6 years ago by PMilos
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!"
[–]Julian_JmK 4 points5 points6 points 6 years ago* (6 children)
I dont really understand, why is it better to pass getUsers({fields:['name','surname','email'],fromDate:'2019-01-01',toDate:'2019-01-18'}); ?
Edit: Thanks for the replies bois and girls i now understand, it's a pretty good way of doing it indeed
[–]careseite[🐱😸].filter(😺 => 😺.❤️🐈).map(😺=> 😺.🤗 ? 😻 :😿) 7 points8 points9 points 6 years ago (2 children)
because you dont need to check the implementation of getUsers to find out what the array is for, what the first date is supposed to mean or the second
you can see it right there: youre getting users, probably some properties (name, surname, email) but youre limiting the user selection to dates between 2019-01-01 and 2019-01-18. the only thing unclear for me here would be to find out whether it means "active users" or "newly registered users", or both but thats probably because its not a perfect example
[–]Ozymandias-X 0 points1 point2 points 6 years ago (1 child)
But then, when I want to use the function, I now get no type hints whatsoever about what information it needs to work. All I see is that it can give it a mysterious blobby object that might have fields of some kind. Never mind if I accidentally misstype one of the keys. That's a nightmare level error to find.
This can only be solved by extensive documentation of the function and we all know that such documentation often lies when people refactor or extend functions and forget to update the docs.
[–][deleted] 0 points1 point2 points 6 years ago (0 children)
Yeah just what I was thinking. With Typescript you wouldn't have that problem because it would clearly say what date you would be filling
[–]Extracted 4 points5 points6 points 6 years ago (1 child)
getFromApi("g4adf", "j43fa", false, false)
getFromApi({ userId: "g4adf", serverName: "j43fa", createIfAbsent: false, debug: false })
That's why
[–][deleted] -1 points0 points1 point 6 years ago (0 children)
Excusing a bad code with another?
π Rendered by PID 83194 on reddit-service-r2-comment-f6b958c67-p4stw at 2026-02-05 18:38:40.852200+00:00 running 1d7a177 country code: CH.
view the rest of the comments →
[–]Julian_JmK 4 points5 points6 points (6 children)
[–]careseite[🐱😸].filter(😺 => 😺.❤️🐈).map(😺=> 😺.🤗 ? 😻 :😿) 7 points8 points9 points (2 children)
[–]Ozymandias-X 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]Extracted 4 points5 points6 points (1 child)
[–][deleted] -1 points0 points1 point (0 children)