5 hands-on exercises and 5 find-the-bug challenges for the JavaScript Date Components lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Report the UTC hours of the date.
Report the weekday number, where Sunday is zero.
Use an array to turn the number into a name.
Set the year to 2027 and report it.
Show the time with leading zeros.
getDate is the day of the month; getDay is the weekday.
Single digits need a leading zero.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspacesetUTCMonth changes the month, not the year.
The day was read without ever being changed.
The wrong getter gives the wrong part.