#4 1st if statement


#1


make sure you log a message to the console to let the player know if he/she has won or lost


what am I doing wrong!


while(slaying) {
    if (youHit) {
    console.log("You Hit!");
    } else {
        console.log("You missed!");
    }
    slaying = false;
}


#2

Please show your complete Code, there is something missing?!


#3

var slaying = true
while(slaying){
slaying = false;
}
while(slaying) {
if (youHit) {
console.log("You Hit!");
}else{
console.log("You missed");
}
slaying = false;
}


#4

I can't figure out what's missing!


#5

You have two while loops.

Your second loop don`t run because in your first you set slaying = false.
Delete your first while loop


#6

that worked thank you!


#7

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