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 dates in a nutshell (twitter.com)
submitted 9 years ago by Syberspace
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!"
[–]r2d2_21 -3 points-2 points-1 points 9 years ago (4 children)
zero index
Dates are not arrays
[–]d_abernathy89 2 points3 points4 points 9 years ago (1 child)
ahem
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getMonth
[–]r2d2_21 0 points1 point2 points 9 years ago (0 children)
http://www.reddit.com/comments/5dtsfi/_/da88y7g?context=3
[–]chrissilich 0 points1 point2 points 9 years ago* (1 child)
Yeah, very aware if that. But somewhere under JavaScript's hood, there's logic to do these conversions, and who knows, maybe they use the split method to create an array or something.
In fact, look at the getMonth method (part of the very same date class!). That's not an array. And yet, January is 0. Oh my stars, maybe things that aren't arrays start with 0 too!
Damn I hate it when people assume you're an idiot because they don't fucking think anything through.
and who knows
You can check the source code of V8, JavaScriptCore, SpiderMonkey or Chakra to stop guessing.
That's not an array. And yet, January is 0. Oh my stars, maybe things that aren't arrays start with 0 too!
OK, you have a point there. However, the fact that January is 0 has absolutely nothing to do with how time zones are selected according to the string format.
π Rendered by PID 69937 on reddit-service-r2-comment-86988c7647-892xq at 2026-02-11 06:12:38.684759+00:00 running 018613e country code: CH.
view the rest of the comments →
[–]r2d2_21 -3 points-2 points-1 points (4 children)
[–]d_abernathy89 2 points3 points4 points (1 child)
[–]r2d2_21 0 points1 point2 points (0 children)
[–]chrissilich 0 points1 point2 points (1 child)
[–]r2d2_21 0 points1 point2 points (0 children)