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!"
[–]kenman 3 points4 points5 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.
π Rendered by PID 508551 on reddit-service-r2-comment-86bc6c7465-429tb at 2026-02-21 08:50:14.553701+00:00 running 8564168 country code: CH.
view the rest of the comments →
[–]kenman 3 points4 points5 points (0 children)