button onclick 홀짝 판별 함수

Grace Goh·2022년 8월 29일
0

Today I learned

목록 보기
2/137
	<script>
        let count = 0
        function hey() {
            count = count + 1
            // count += 1
            if (count % 2 == 0) {
                alert('짝수입니다!')
            } else {
                alert('홀수입니다!')
            }
        }


    </script>
</head>

<body>
    <div class="mytitle">
        <h1>혜바라기가 알려준 책들</h1>
        <button onclick="hey()">영화 기록하기</button>
    </div>
profile
Español, Inglés, Coreano y Python

0개의 댓글