Files
learn_enough_javascript_cod…/Listing_5.3.js
T
2022-01-12 14:58:42 -08:00

7 lines
246 B
JavaScript

// Returns the day of the week for the given date.
function dayName(date) {
const daysOfTheWeek = ["Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"];
return daysOfTheWeek[date.getDay()];
}