<!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>Secret Game</title>
</head>
<body>
<input/>
<button>verificar si acertó con el secreto</button>
<script>
//var secreto = Math.round(Math.random()* 10);
var secreto = [3,5,7,9];
var input = document.querySelector("input");
input.focus();
function verificar() {
var encontrado = false;
for (var i = 0; i < secreto.length; i++) {
if (parseInt(input.value) == secreto[i]) {
alert("usted acertó");
encontrado = true;
break;
}
}
if (encontrado == false) {
alert("usted erro");
}
input.value = "";
input.focus();
}
var button = document.querySelector("button");
button.onclick = verificar;
</script>
</body>
</html>