我得到的錯誤「語法錯誤:意外標記{」,我不知道爲什麼,因爲一切都很似乎很正確!你可以幫幫我嗎 ?語法錯誤:意外標記{在剪刀石頭布
var userChoice = prompt("Choose: rock, paper or scissors?");
var computerChoice = Math.random();
if(computerChoice >= 0 && computerChoice <= 0.33){
computerChoice === "rock";
}
else if (computerChoice >= 0.34 && computerChoice <= 0.66){
computerChoice === "paper";
}
else (computerChoice >= 0.67 && computerChoice <= 1){
computerChoice === "scissors";
}
你需要把所有到一個函數 – Typo 2015-02-07 01:12:21
你錯過了最後'else'後'if'。 – 2015-02-07 01:12:31
謝謝@Typo! =] – 2015-02-07 01:14:16