Declare your variables -- fall in problem


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")


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)


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