What's wrong with the code? exercise with vector and comparison of values

1

In the code below I want to choose some numbers and for them in a vector, the user will try to guess them and his bid or kicks will be saved in another vector and in the end I will inform the user how many numbers he has hit, I created this code but it does not run at all, and the browser console reports nothing. What is the problem with the code?

>  <input type="text" id="numero" />
>     <input type="submit" value="lance" id="verificar"/>
>     <script>
>     var loteria = [1,6,3]
>     var sorteados = []
>     var lance = document.getElementById("numero")
>       var botao = document.getElementById("verificar")
>           botao.onclick = clicado
>           var clicado = function() {
>               var aux=0       
>                   sorteados.push(lance)
>                   for (var i = 0;i<loteria.legth;i++){
>                       if(lance.value == loteria[i]){
>                           aux++
>                           return
>                       }   
>                   }
>               if (sorteados.legth == 3){
>               alert ("voce acertou"+aux)
>               }
>           }
>     </script>
    
asked by anonymous 21.05.2017 / 22:11

0 answers