<!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>Juego de adivinar</title>
</head>
<body>
<input/>
<button> verificar si acerto con el secreto </button>
<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 se equivoco")
}
input.value = "";
input.focus();
}
var button = document.querySelector("button")
button.onclick = verificar;
</script>
</body>
</html>