JavaScript · Senior · Question 29 of 75
What does new Date(2025, 1, 1).getMonth() return, and which month is it?
- ✓Correct answer:
1- February - 2
1- January - 3
2- February
Explanation
Months in Date are zero-based, while days start at one. It's a common source of bugs along with time zones and Date mutability. Use Intl.DateTimeFormat for formatting; the Temporal API is replacing Date.