为什么我的纸张,摇滚,剪刀程序不起作用?

时间:2013-10-09 03:59:03

标签: javascript

我需要使用大写字母吗?

var userChoice=prompt("Do you choose rock, paper or scissors?");
var computerChoice=Math.random();
if (computerChoice>0 && computerChoice<0.33)
   {
     computrChoice=("rock");
   }
else if (computerChoice>0.34 && computerChoice<0.66)
    {
      computerChoice=("paper");
    }
else{computerChoice=("scissors");}
    console.log(computerChoice);

1 个答案:

答案 0 :(得分:0)

var userChoice=prompt("Do you choose rock, paper or scissors?");
var computerChoice=Math.random();
if (computerChoice>0 && computerChoice<0.33)
   {
     computrChoice=("rock");        <<---- you have spell error here
   }
else if (computerChoice>0.34 && computerChoice<0.66)
    {
      computerChoice=("paper");
    }
else{computerChoice=("scissors");}
    console.log(computerChoice);