Skip to content
On this page

1185. Day of the Week

https://leetcode.com/problems/day-of-the-week/submissions/

js
/**
 * @param {number} day
 * @param {number} month
 * @param {number} year
 * @return {string}
 */
var dayOfTheWeek = function(day, month, year) {
    const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
    return days[new Date(year, month - 1, day).getDay()]
};