Syntax error in character/gear selection


#1

Can you find the "SyntaxError: Unexpected token ILLEGAL" errors? My eyes hurt lol.

var characterStats = []; //ATTK,SPD,DEF
var characterHitPoints = 100;
var characterChoice = "0";
var loopy = 1;
var gearChoice = "0";

//Character Selection
do {
characterChoice = prompt("Choose your character type: (1/2/3)\n\n(1)Archer: A ranged combatant with a fast attack speed. Archers can only be hit by ranged attacks.\n\n(2)Warrior: The warriors damage, speed and defense can very greatly depending on the selection of short sword/shield combination or having just a long sword.\n\n(3)Barbarian: The barbarian is generally slow but extremely strong and has impressive defense.");

//input validation for character selection
if (characterChoice === "1"){
loopy = 0;
} else if (characterChoice === "2") {
loopy = 0;
} else if (characterChoice === "3") {
loopy = 0;
} else {
loopy = 1;
alert("Please enter a valid character selection.");}
} while (loopy); //end of character selection loop

//Gear Selection and character stat assignment
do { //start of gear slection loop
if (characterChoice === "1") { //Archer
//prompt for gear selection
gearChoice = prompt("Choose your bow: (1/2)\n\n(1)Long Bow: This bow offers a slightly higher damage at a slight reduction in speed.\n\n(2)Crossbow: This bow offers maximum speed at a slight reduction in damage.");
if (gearChoice === "1") { //long bow
characterStats = [4,7,4];//ATTK,SPD,DEF
loopy = 0;
} else if (gearChoice === "2") { //crossbow
characterStats = [3,10,4];//ATTK,SPD,DEF
loopy = 0;
} else {
alert("Please enter a valid gear selection);
loopy = 1;}
} else if (characterChoice === "2") { //Warrior
//prompt for gear selection
gearChoice = prompt("Choose your gear: (1/2/3)\n\n(1)Longsword: This is a two handed sword that offers maximum damage at a great cost in speed and a small reduction in defense.\n\n(2)Shortsword + Sheild: This combination offers moderate damage and speed while increasing defense to almost the maximum.\n\n(3)Double Shortsword: This combination offers an almost maximum to speed, a cost to damage and a great cost to defense.");
if (gearChoice === "1") { //Longsword
characterStats = [10,3,6];//ATTK,SPD,DEF
loopy = 0;
} else if (gearChoice === "2") { //shortsword + sheild
characterStats = [6,5,9];//ATTK,SPD,DEF
loopy = 0;
} else if (gearChoice === "3") { //double shortsword
characterStats = [5,9,4];//ATTK,SPD,DEF
loopy = 0;
} else {
alert("Please enter a valid gear selection);
loopy = 1;}
} else if (characterChoice === "3") { //Barbarian
//prompt for gear selection
gearChoice = prompt("Choose your gear: (1/2/3)\n\n(1)Great Axe: This weapon offers maximum damage at a cost to speed and defense.\n\n(2)Double Small Axe: This combination offers almost maximum speed at a cost great cost to damage and a slight reduction in defense.");
if (gearChoice === "1") { //Great Axe
characterStats = [13,2,8];//ATTK,SPD,DEF
loopy = 0;
} else if (gearChoice === "2") { //double small axe
characterStats = [5,9,9];//ATTK,SPD,DEF
loopy = 0;
} else {
alert("Please enter a valid gear selection);
loopy = 1;}
}
} while (loopy); //end of gear selection loop

console.log(characterStats);


#2

Found it with the help of a redditer! Missing double quotes in some of the alerts.


#3

Just that and you should be fine! Just put it in double quotes