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

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

https://www.codecademy.com/courses/javascript-beginner-en-mrTNH-6VIZ9/0/5?curriculum_id=506324b3a7dffd00020bf661<In what way does your code behave incorrectly? Include ALL error messages.>

```

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;

}
}

<do not remove the three backticks above>

#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: