涉及“else if”和缺少操作数的错误

时间:2014-03-02 02:34:42

标签: javascript

我在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行得到错误“缺少操作数”(否则if(evade =“n”); {)并且我无法弄明白。请帮忙!

1 个答案:

答案 0 :(得分:2)

在比较中使用===只是一项任务。

然后不要在;if之后添加else if