getDaybeginnerconst d = new Date(2024, 0, 15) // Monday
d.getDay() // β 1
// 0=Sun, 1=Mon, β¦, 6=SatUse getDay() to retrieve the day of the week (0 = Sunday through 6 = Saturday) in local time.
Sunday has the index 0. Jan 7, 2024 was a Sunday.
Challenge: Verify that new Date(2024, 0, 7).getDay() returns 0.