Declare your variables -- fall in problem


#1

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

they say , there is a syntax problem , need help to correct it .

var slaying = true
var youHit = Math.floor(Math.random() * 2)

var damageThisRound = Math.floor(Math.random()*5 + 1)

var = totalDamage 

while (slaying) {
    if (youHit){
        console.log ("you hit")
         }
    else {
        console.log("you missed")
        }
    
    };

#2

this seems like a problem:

var = totalDamage

i think you want to create a variable total damage and set it to zero, not?

I am not going to run this code, looks like a infinity loop (just a heads up)


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.