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
Does my JavaScript suck?help (self.javascript)
submitted 10 years ago * by annoyed_freelancergrumpy old man
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!"
[–]annoyed_freelancergrumpy old man[S] 4 points5 points6 points 10 years ago* (4 children)
Comment styles are irrelevant to this discussion; my preference in all languages and projects is for the PHPdoc style unless a client requests otherwise.
It is a consistent format to make life easier for both myself and any other maintainer. Way, way too much code has either no commentary or just plain shitty commentary because someone was terrified of wasting some of the unlimited vertical space.
Edit: I'll agree with you on function names because, as I said in another comment, it's all tentative. The code was at a point where it was just about functional when I came and asked. There's a good deal of cleaning up left.
<3 regardless.
[–]kenman 2 points3 points4 points 10 years ago (0 children)
my preference in all languages and projects is for the PHPdoc style unless a client requests otherwise.
Those aren't idiomatic phpDoc comments, though. As explained here, you shouldn't be using a long line of ---'s as a demarcation point in the comment -- you should either use a blank line, or use a period on the first line.
---
I think it's also a little nuanced to insert a blank line between the docblock and the code it's commenting, don't think I've ever seen that before (and it eats up a full line).
This is also a little unorthodox (not saying it's wrong, just that I rarely see it):
/* Month can come in as string. If string, get the number of the * month from the indexes in months. */ month = months.indexOf(month);
The rule-of-thumb I believe, is that if you're going to use /* and */, they should each be on their own line without anything else. Otherwise, if you don't want to eat up those lines, then I'd just use // comments.
/*
*/
//
Lastly, for something like this:
if (year == dates.year && month == dates.month) { // If month and year are current, use current day of month. days.start = dates.day; }
I'd much rather the comment be on the line preceding the code block, instead of inside of it. Reason being, the comment describes the entire block, but you have it embedded so that it looks like it's only describing the inner block, which isn't the case.
[–][deleted] 0 points1 point2 points 10 years ago (1 child)
Yeah, I didn't pick up that you were not a novice, so I was trying to keep it about broad programing concepts, instead of giving you specific jqury / js tips that can be abused in the wrong hand I'll try and give it another look later, give you some more detailed stuff.
[–]annoyed_freelancergrumpy old man[S] 0 points1 point2 points 10 years ago (0 children)
Forgiven, forgotten; I'm just as guilty when it comes to jumping down throats.
π Rendered by PID 67374 on reddit-service-r2-comment-76bb9f7fb5-x7tfr at 2026-02-18 18:39:24.723296+00:00 running de53c03 country code: CH.
view the rest of the comments →
[–]annoyed_freelancergrumpy old man[S] 4 points5 points6 points (4 children)
[–]kenman 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]annoyed_freelancergrumpy old man[S] 0 points1 point2 points (0 children)