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

Tell us what’s happening:

It is telling me to : “set health to equal health minus the monster’s level. Remember you can get this from the monsters[fighting].level property.” I did this, (although obviously i’m wrong.) what am I doing wrong? I added health -= monsters[fighting].level which i thought would do it, but its not working.

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.    [currentWeaponIndex].name + ".";
  health -= monsters[fighting].level;
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36

Challenge Information:

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

This worked for me. Can you reset and try again?

1 Like

does reseting reset the entire thing or just the level im on?

It just resets the current step.

ok yeah ill try that

1 Like

yeah that worked. Thanks!

1 Like