2016년(프로그래머스)

정승옥(seungok)·2020년 11월 16일
0

프로그래머스

목록 보기
5/40

문제설명

  • a, b를 입력받아 2016년 a월 b일이 무슨 요일인지 리턴하는 함수 완성

제한조건

  • 2016년은 윤년

풀이

function solution(a, b) {
    const selectDay = `2016 ${a} ${b}`;
    const findDay = new Date(selectDay).toDateString();
    const answerDate = findDay.toUpperCase().split(' ')[0];
    
    return answerDate;
}

체크포인트

  • new Date().toDateString(): 요일 월 날짜 연도
  • toUpperCase(): 문자열의 값을 대문자로 리턴
  • split(' '): 구분자로 문자열을 잘라 배열로 저장
profile
Front-End Developer 😁

0개의 댓글