diff --git a/1185.day-of-the-week.js b/1185.day-of-the-week.js new file mode 100644 index 0000000..1b2535f --- /dev/null +++ b/1185.day-of-the-week.js @@ -0,0 +1,15 @@ +/** + * URL of this problem + * https://leetcode.com/problems/day-of-the-week/ + */ + +/** + * @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(`${month}/${day}/${year}`).getDay()]; +};