Javascript 涉及“的错误”;否则,如果;和缺少的操作数
我正在用JavaScript制作一个choose you own冒险风格的游戏,在本节中:Javascript 涉及“的错误”;否则,如果;和缺少的操作数,javascript,Javascript,我正在用JavaScript制作一个choose you own冒险风格的游戏,在本节中: 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
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后面加;
,在比较中使用=
。=
只是一个作业。然后不要在if
和else if
后面加,谢谢!这解决了问题problem@ced-b-你应该回答这个问题,然后做手术在其他人之前接受它:)只有在游戏的这一部分你才会遇到这种问题?它还处于非常早期的部分,这是一段很好的代码,所以,是的