<!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>
let secretNumber = Math.round(Math.random()*10),
input1 = document.querySelector("input");
input1.focus();
function verificar () {
if (parseInt(input1.value) == secretNumber) {
alert("Es correcto");
} else {
alert("Incorreto");
};
input1.value = "";
input1.focus();
};
let button = document.querySelector('button');
button.onclick = verificar;
</script>
</body>
</html>