4/6 console.log is not a function


#1

So... i got problem with 4/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");
    } else {
        console.log("You missed");
    }
    slaying = false;
}

It seems ok. Yet it still shows

TypeError: console.log is not a function

whats wrong?

funny thing is that if i looked back at 1/6 it shows that everything is ok while in console is the same error with console.log


#2

Your code is correct.

Please:

  1. Copy your code.
  2. Click Reset Code.
  3. Click Save & Submit Code
  4. Paste your code back into the editor
  5. Submit it again.

#3

Lol i did it twice before and it failed every time. Now it works... strange.

Anyway thanks for help.


#4

Glad it works now. You're welcome.


#5

var slaying=true;
var youHit= Math.floor(Math.random() * 2)
var damageThisRound= Math.floor(Math.random() * 5 +1)
var totalDamage = 0
var loop = function() {
while(slaying) {
if (youHit) {
console.log("You hit!");
} else {
console.log("You missed!");
}
slaying = false;
}};
Help! I keep getting this error:" Make sure you log a message to the console to let the player knows if (s)he won or lost!".


#6

You are having two }}; remove one } .