Whats wrong with my code!


Can someone tell me whats wrong with my code? Thanks in advance :wink:

var slaying = true;
var youHit = Math.floor(Math.random() * 2);
var damageThisRound = Math.floor(Math.random() * 5 + 1);
var totalDamage = 0;

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


Can you please tell me which part is this from 1- 6 and its look like your while does not do anything. you dont have to declare var slaying again you already did at the start.
your if statement should go inside the while loop and then slaying = false;


Well, take a look at some of your lines inside the code.

No semicolons.

There :wink: