[리트코드] 1185. Day of the Week 본문

코테 문제 풀이

[리트코드] 1185. Day of the Week

미니모아 2023. 2. 14. 07:57
반응형
function dayOfTheWeek(day: number, month: number, year: number): string {
    const dayOfTheWeekArray = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
    return dayOfTheWeekArray[new Date(year, month-1, day).getDay()]
};

date 객체:

https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Date

반응형
Comments