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

Tell us what’s happening:

I have tried to mess with this put it in different orders I’ve read all the comments I can’t figure it out. I put it in like this which I feel like should be correct and nothing happens I wont even tell me what I’m doing wrong. I’ve relet the problem a couple times but I don’t really understand why this is incorrect if someone can explain this for me I would appreciate it.

I’m not sure if it shows the error message when I post it but I had just left it alone to get to the error message nothing changes when I put in the code that I have…

Your code so far


The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

function attack() {
  text.innerText = "The " + monsters[fighting].name + " attacks.";
  text.innerText += " You attack it with your " + weapons[currentWeapon].name + ".";
  health -= monsters[fighting].level;
  monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1;
  healthText.innerText = health;
  monsterHealthText.innerText = monsterHealth;
  if (health <= 0) {
  } else if (monsterHealth <= 0) {
    fighting === 2 ? winGame():defeatMonster();

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.1 Safari/605.1.15

Challenge Information:

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

It seems like you have too many closing curly brackets here

1 Like

thank you I messed with that for way to long I figured it was gonna be something simple. I’m gonna delete the post