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

Tell us what’s happening:

Hello Everyone, I’m stuck here, don’t know what to do. Please help me how to solve this challenge

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

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;
  
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36

Challenge Information:

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

  • Update healthText.innerText to equal health
  • Update monsterHealthText.innerText to equal monsterHealth

You can look at line 159 in goFight() function as a reference.

1 Like

Thanks you so much, it worked

1 Like