当我运行这段代码时,我应该不会收到任何错误,但是我和它的右边是那些波浪形的括号。我已经改变了的东西和移动的东西,改变了代码,但这个错误是永远存在的:为什么我在squigly括号旁出现错误?
var name = prompt("What is your name?");
var bosshp = 150;
var playhp = 100;
alert("You are going to fight a boss");
alert("You have 100hp while the boss has 150hp, you deal between 1 and 10 damage while he does between 1 and 15 damage.");
alert("You have two actions and two special abilities. Your moves are block, and attack. Blocking heals you for 5 while attacking attacks...Your special abilities are crit chance and dodge chance. There is a 25% chance to deal double damage and a 15% chance that you will dodge the bosses attack!");
alert("Ok " + name + ", You have to fight Gorlock, the monkey king. ");
do
{
var q = prompt("What will be your first move?\nEnter either 'block' or 'attack'");
if (q === "block")
{
playhp = playhp + 5;
}
else if (q === "attack")
{
function attack();
}
}
while (bosshp >= 0 || playhp >= 0);
function attack() {
if ((Math.floor((Math.random() * 100) + 1)) < 16) {
bosshp = bosshp - (Math.floor((Math.random() * 10) + 1) * 2);
} else {
bosshp = bosshp - (Math.floor((Math.random() * 10) + 1));
}
}
仅供参考工具,说卷曲y括号,而不是波形括号(尽管我知道你的意思,其他人可能不会)。 – 2014-10-28 02:10:10
哪个花括号?我们无法看到您的屏幕,也看不到任何大括号 – jasonscript 2014-10-28 02:22:49