<meta charset="UTF-8">
<input/>
<button>Compare com o meu segredo</button>
<script>
var segredo = 5
var input = document.querySelector("input");
function verifica () {
if(input.value == segredo )
{alert("success");}
else {alert("Failure");}
var button =document.querySelector("button");
button.onclick = verifica;
</script>