Server crashes when trying to slay the dragon


#1

My code makes my server crash. What am I doing wrong here?

var slaying = true
var youHit = Math.floor(Math.random() * 2)
var damageThisRound = Math.floor(Math.random()* 5 + 1 )
var totalDamage = 0
while(slaying) {console.log ("lekker slachten")};
if (youHit =1) {console.log ("Je hebt de draak geraakt");
} else {
console.log("De draak heeft je dood gemaakt");

slaying = false

}


#2

Wrongly assigning rather than comparing. :slight_smile:


#3

Thanks, so changing it to

if (youHit ===1)

you mean?

Still the same error happens; server crashes..