Shouldn't the code for the June 11th, 1988 date have a 6 instead of a 5? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Shouldn't the code for the June 11th, 1988 date have a 6 instead of a 5?

30th Sep 2015, 11:08 AM
mavdjtslknceheu
mavdjtslknceheu - avatar
4 Answers
+ 1
JS defines months starting by 0, i.e. may is 4, june is 5 and january is 0.
2nd Jan 2016, 11:59 AM
Tomas K.
Tomas K. - avatar
0
Because the month count starts at 0
22nd Feb 2016, 2:35 PM
Souhayel Abassi
Souhayel Abassi - avatar
0
Yes, it should be May if the moth is referred as 5 in other languages but JavaScript counts months from 0 (January) as said in the note below.
19th Dec 2016, 8:33 PM
Piotr Romanowski
Piotr Romanowski - avatar
0
The month count in JavaScript starts from 0 😄
8th Feb 2017, 3:41 PM
Animesh Gupta
Animesh Gupta - avatar