<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>퀴즈판독기</title>
</head>
<body>
<p>태조 이성계가 태어난 연도는?</p>
<input type="text" id="answer">
<button type="submit" id="send-answer">정답확인</button>
<script>
const answerBtn = document.querySelector('#send-answer');
let count = 0;
answerBtn.addEventListener('click', function() {
count++;
const answer = document.querySelector('#answer').value;
console.log(answer);
if (answer == 1335) {
alert('정답!');
count = 0;
} else if (answer != 1335 && count < 3) {
alert('땡');
} else if (answer != 1335 && count >= 3) {
alert('멍청아! 공부 다시 해와라?');
}
})
</script>
</body>
</html>