3/6 help


#1

var slaying = true;

var youHit = Math.floor(Math.random() * 2);

var damageThisRound = Math.floor(Math.random() * 5 + 1);
var totalDamage = 0;
while (slaying) {
if (youHit) {
console.log("You hit the dragon and did " + damageThisRound + " damage!");
totalDamage += damageThisRound;

It says SyntaxError: missing } in compound statement


#2

Add one or two } to the end of it. If that is all of your code they are missing after while and if.


#3

Thanks :smile: :stuck_out_tongue::smiley:


#4

whats the code for this one


#6

var slaying = true;

var youHit = Math.floor(Math.random() * 2);

var damageThisRound = Math.floor(Math.random() * 5 + 1);
var totalDamage = 0;
while (slaying) {
if (youHit) {
console.log("You hit the dragon and did " + damageThisRound + " damage!");
totalDamage += damageThisRound;

Hey guys, whats wrong with this? :smile: