2016년

강동휘·2022년 11월 29일
0

프로그래머스

목록 보기
1/6
post-thumbnail

DAY 함수를 활용한 방법 (1)

const a = new Date(2016, 4 , 24) const arr = ['일','월', '화', '수' ,'목', '금' ,'토'] a.getDate() a.getMonth()+1 a.getFullYear() a.getDay() arr[a.getDay()]

const week = ['SUN','MON','TUE','WED','THU','FRI','SAT']

function solution(a, b) {
const answer = new Date(2016 , a-1 , b).getDay()
return week[answer]
}
실행 결과
테스트 1
입력값 〉	5, 24
기댓값 〉	"TUE"
실행 결과 〉	테스트를 통과하였습니다.
profile
👨🏻‍💻프론트엔드에서 pm으로 커리어 전향을 희망하는

0개의 댓글