問題文
A developer needs to build a Date for the third of March in a given year and then read the month back for a label. Which two statements about the Date constructor and its accessors are correct? (Select two.)
選択肢
- The month argument of the constructor is zero based, so March is passed as 2.
- Passing a month value of 12 throws a RangeError, so the constructor protects against off by one mistakes.
- getMonth also returns a zero based number, so a human readable label needs getMonth() + 1.
- The day of month argument is zero based as well, so the third of the month is passed as 2 for consistency with the month argument.
- getDay returns the day of the month, so it can be used directly in a label that shows which date of the month the record belongs to.