<meta charset="UTF-8">
<h3>Programa de Adivinar numero secreto</h3>
<input type="text">
<button class="btn-verificar">Verificar si acierta número</button>
<script>
//var numSecreto = Math.round(Math.random()*10);
var input = document.querySelector("input");
input.focus();
var secretos = [3,5,7,9];
function verificar(){
var encontrado=false;
for (var position = 0; position < secretos.length; position++) {
if(parseInt(input.value) == secretos[position]){
alert("Usted acertó");
encontrado=true;
break;
}
}
if(encontrado == false){
alert("Usted erró");
}
input.focus();
input.value = "";
}
var button = document.querySelector("button");
button.onclick = verificar;
</script>