2

私はコーディングが初めてで、何が間違っているのかわかりません。if/else を書き込もうとするたびに、ステートメントが存在するところまでは機能しますが、その後は機能しません。

これは私が書いたものです:

alert("welcome to chloe's quiz show!")
var name = prompt("contestant, what is your name?")
var help = prompt("is this your first time playing? type 'yes' or 'no'.")
if (help === yes){
alert("the game is easy! all you have to do is type the letter that corresponds with  the correct answer. then press 'ok'.")
confirm("lets get started!")
}
else{
confirm("lets get started then!")
}
4

2 に答える 2

6

この行を変更します。

if (help === yes)

これに:

if (help == "yes")

yesは変数ではないので。

于 2013-09-04T03:51:29.903 に答える
3
if (help === 'yes')

yesは文字列です。引用符で囲む必要があります

于 2013-09-04T03:52:10.203 に答える