我是新手好吗?我只是不知道我的代码有什么问题,如果有人能解决它,请向我解释......
代码:
<script>
var userMoney:10;
var userChoice = prompt("Okay young lad, you've got 3 choices, either you choose box 1, 2 or 3");
if(userChoice==="1"){
confirm("Wow. You're just that lucky, you've got 10$ added to your account");
}
if(confirm("Wow. You're just that lucky, you've got 10$ added to your account"){
userMoney:10+10;
}
var yesno = prompt("Would you like to see how much money you've got lad?");
if(yesno==="yes"){
confirm(userMoney)
} else {
confirm("Well lad I Guess that's the end of the game.");
}
if(userChoice==="2"){
confirm("Oi, bad luck Brian better luck next time");
}
if(userChoice==="3"){
confirm("Oi, bad luck Brian better luck next time");
}
</script>
答案 0 :(得分:3)
var userMoney:10;
应为var userMoney = 10;
userMoney:10+10;
可以是:userMoney = userMoney + 10;
或userMoney += 10;
答案 1 :(得分:2)
答案 2 :(得分:0)
更改userMoney = 10 + 10; 并且也改变了 userMoney = 10