I don't know what's wrong with this I keep getting SyntaxError: Unexpected identifier 'slaying' I have no idea what is wrong plz help!


#1


https://www.codecademy.com/courses/javascript-beginner-en-mrTNH-6VIZ9/0/5?curriculum_id=506324b3a7dffd00020bf661


var slaying = true
var youHit = Math.floor(Math.random() * 2)
var damageThisRound = Math.floor(Math.random()*5 + 1)
var totalDamage = 0
while(slaying) {
    if(youHit) {
        console.log("Nice shot!  Take that you oversized lizzard!");
        totalDamage += damageThisRound
        if(totalDamage >= 4) {
            console.log("You slew the dragon!  The roaster becomes the roasted!") slaying = false
        } else {
         youHit = Math.floor(Math.random() * 2)  
        }
    } else {
        console.log("Oooooohhhhhhhh... That does NOT look pleasant...");
    
    slaying = false;
}
}


#2

You gotta put the first "slaying = false" on a separate line. Right now it's on the same line as the console.log, and that's why you are strong the syntax error


#3

Thank you so much! :relaxed: