<!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>Document</title>
</head>
<body>
<input/>
<button>Verificar si se acerto con el secreto</button>
</body>
<script>
var secreto=Math.round(Math.random()*10);
var input=document.querySelector("input")
input.focus();
function verificar(){
if(parseInt(input.value)==secreto){
alert("usted acerto")
}
else{
alert("usted erro")
}
input.value="";
input.focus();
}
var boton=document.querySelector("button")
boton.onclick=verificar;
</script>
</html>