我正在用JavaScript制作一个选择你自己的冒险风格的游戏,在本节中:
evade = prompt("Go out of your way to avoid them, just in case? (y/n)");
if(evade = "y");
{
alert("Even though you went well out of your way and changed course multiple times,the two men are still with you.");
alert("Your stalkers have kept the same pace and distance the entire time but do not seem to be interested in confrontation.");
}
else if(evade = "n"); {
alert("the two men have caught up with you.");
alert("as you turn the corner, they sweep you off your feet and stab you");
alert("you are dead");
}
我在第 9 行收到错误"缺少操作数"(否则如果(逃避 = "n");{)我想不通。请帮忙!
在
比较中使用==
。 =
只是一个任务。
然后不要在你的if
和else if
之后放一个;
.