혼공JS 4주차 미션

withbeth·2021년 8월 1일
0

혼공JS

목록 보기
4/6

>>Chapter 05~06

기본미션: 202쪽의 <윤년을 확인하는 함수 만들기> 예제를 실행하여 2021년이 윤년인지 확인하는 결과 인증샷

<body>
    <script>
        function isLeapYear(year) {
            return (year % 4 === 0) && (year % 100 !== 0) || (year % 400 === 0)
        }

    console.log(`2020년은 윤년일까? === ${isLeapYear(2020)}`)
    console.log(`2010년은 윤년일까? === ${isLeapYear(2010)}`)
    console.log(`2000년은 윤년일까? === ${isLeapYear(2000)}`)
    console.log(`1900년은 윤년일까? === ${isLeapYear(1900)}`)
    </script>
</body>

0개의 댓글

관련 채용 정보