Jump to content

pedrosergiovaz

Members
  • Content count

    1
  • Joined

  • Last visited

Community Reputation

0 Comum

About pedrosergiovaz

  1. pedrosergiovaz

    Iniciante, nao sei oque esta errado

    coloquei esse codigo em um html dentro da tag <body> <script type="text/javascript"> do{ var userChoice = prompt("Do you choose rock, paper or scissors?"); var computerChoice = Math.random(); if(computerChoice < 0.34){ computerChoice = "rock"; } else if(computerChoice >= 0.34 && computerChoice < 0.67){ computerChoice = "paper"; } else{ computerChoice = "scissors"; } if(computerChoice === userChoice){ alert("voce e o computador escolheram a mesma resposta, escolha outra"); } }while(userChoice !== "rock" && userChoice !== "paper" && userChoice !== "scissors" && userChoice !== "rope" || userChoice === computerChoice); var compare = function(choice1, choice2){ //document.write("The Computer choose :" + choice2 + ", and you choose :" + choice1); if (choice1 === "rope"){ document.write("Eu nao faço ideia de quem a corda ganha"); } if(choice1 === choice2){ document.write( "The result is a tie!"); }else if(choice1 === "rock" && choice2 === "scissors"){ document.write( "rock wins"); }else if(choice1 === "rock" && choice2 === "paper"){ document.write( "paper wins"); }else if(choice1 === "paper" && choice2 === "rock"){ document.write( "paper wins"); }else if(choice1 === "paper" && choice2 === "scissors"){ document.write( "scissors wins"); }else if(choice1 === "scissors" && choice2 === "paper"){ document.write( "scissors wins"); }else{ document.write( "rock wins"); } }; compare(userChoice, computerChoice); } </script> nao consigo encontrar o problema, quando eu abro a pagina nao executa o JS
×

Important Information

Ao usar o fórum, você concorda com nossos Terms of Use.