MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/btxz72/what_are_some_javascript_things_beginners_dont/ep66xc1/?context=3
r/javascript • u/[deleted] • May 28 '19
383 comments sorted by
View all comments
Show parent comments
47
This allows you to use the month as an index:
> ['jan', 'feb', 'mar', 'apr', 'may', 'etc'][new Date().getMonth()] "may"
It probably sounded like a good idea at the time.
Anyhow, that's why it is that way. This behavior isn't unique to JS either.
44 u/NotSamNub May 28 '19 Ah, out of the 6 months in the year, my favourite has to be "etc", such lovely weather during that time of year! 0 u/[deleted] May 28 '19 [deleted] 10 u/TyrionReynolds May 28 '19 Lousy Smarch weather. → More replies (1)
44
Ah, out of the 6 months in the year, my favourite has to be "etc", such lovely weather during that time of year!
0 u/[deleted] May 28 '19 [deleted] 10 u/TyrionReynolds May 28 '19 Lousy Smarch weather. → More replies (1)
0
[deleted]
10 u/TyrionReynolds May 28 '19 Lousy Smarch weather. → More replies (1)
10
Lousy Smarch weather.
→ More replies (1)
47
u/inu-no-policemen May 28 '19
This allows you to use the month as an index:
It probably sounded like a good idea at the time.
Anyhow, that's why it is that way. This behavior isn't unique to JS either.