Learn Basic JavaScript by Building a Role Playing Game - Step 139

I can’t see where my mistake is. The challenge says this

Back to your attack function - inside the else if block, create another if and else statement. If the player is fighting the dragon (fighting would be 2), call the winGame function. Move the defeatMonster() call to the else block.

### Your code so far

} else if (monsterHealth <= 0) {
    if (fighting === 2) {
      winGame();
    } else { 
      defeatMonster();
  }

edit: I get an error which says ‘syntax error: unknown: unexpected token’ and it points at line 219, at the end of my code, however, that unexpected token is a closing curly bracket closing a function, here it is:

SyntaxError: unknown: Unexpected token (219:1)

  217 |   xpText.innerText = xp;
  218 |   goTown();
> 219 | }
      |  ^

there is no spaces next to the curly bracket, could it be a bug or something?

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0

Challenge Information:

Learn Basic JavaScript by Building a Role Playing Game - Step 139

do you have the else if closing }? it looks like it’s what is missing

oh yeah, that was it… thanks

1 Like