The "=" is an assignment operator in JavaScript. So the line above is assigning the value "true" to the variable "youHit", when what you want to do is test whether the value of youHit is true. To do this, you need to use the equality comparison operator, which is "===".

2.when you assign true for youHit it will always be true but it should not be that's why we are using Math.random and also if you continue to use true then you will never lose you either hit dragon or win

3.the last else is extra becuse if you not hit it will goes to you lose which means dragon defeat you so delete it

4.slaying=false which is just below "you lose" , should be out of else loop and should be pasted just before while loop ends.

2.when you assign true for youHit it will always be true but it should not be that's why we are using Math.random and also if you continue to use true then you will never lose you either hit dragon or win

3.the last else is extra becuse if you not hit it will goes to you lose which means dragon defeat you so delete it

4.slaying=false which is just below "you lose" , should be out of else loop and should be pasted just before while loop ends.

hey thank u so much for helping me out but even after making changes i could not run it and it seem i am stuckvar slaying=true;var youHit=Math.floor(Math.random()*2);var damageThisRound=Math.floor(Math.random()*5 + 1);var totalDamage=0;while(slaying){ if(youHit===true) { console.log("you just hit the dragon."); totalDamage+=damageThisRound; if(totalDamage>=4) { console.log("You Win!"); slaying=false; } else { youHit=Math.floor(Math.random()*2); } else{ console.log("you lose!"); }