Unexpected Token Else

javascript

#1

This code is unfinished, but I was bug testing before I went any farther, and I kept getting and "Unexpected token else." I can't figure out what's wrong with it.


var start=confirm("Welcome to RP Through Commands. To being please hit okay.")
if (start=true) {
var WhatClass= prompt("What class are you?", "Mage, warrior, or healer")
var WhatClassLow=WhatClass.toLowerCase()
if (WhatClassLow="mage") {
var WhatWeapon=prompt("What weapon do you want? Staff, runes, or a wand?").toLowerCase()
}
if else (WhatClassLow="warrior") {
var WhatWeaponTwo=prompt("What weapon do you want? Sword, knife, or club?").toLowerCase()
}
if else (WhatClassLow="healer") {
var WhatWeaponThree=prompt("How will you heal? Magic, herbs, or modern day medicine?").toLowerCase }
}
else {
var areYouSure=prompt("Are you sure you want to quit?")
}


#2

check the order of your else if blocks. the correct syntax is

if(___){/*statements*/}
else if(___){/*statements*/}
else{/*statements*/}

In addition to that make sure every opening brace has a matching closing brace


#3

Thank you! I switched them, and now the code works.