<!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>Secreto</title>
<h1>SECRETO</h1>
</head>
<body>
<input placeholder="Digite numero aqui" />
<button>Comprobar número secreto</button>
<script>
var secretNumber = 4,
userNumber = document.querySelector("input");
function verificar () {
if (parseInt(userNumber.value) == secretNumber) {
alert("Es correcto");
} else {
alert("Incorreto");
};
};
let button = document.querySelector('button');
button.onclick = verificar;
</script>
</body>
</html>