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

Tell us what’s happening:

Hello,

Can someone explain to me what “xp” is, in the answer to this question? I understand most of the code, but I assumed xp would be a variable, but we never declared a variable called “xp” anywhere else in the code, so I’m not sure what it means, or what exactly it’s function is in the code.

Thank you!

Your code so far

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

/* file: styles.css */

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

  monsterHealth -= weapons[currentWeaponIndex].power;

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36

Challenge Information:

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

you defined the variable xp on line 1

it is the experience the player has accumulated so far, in game terms

Oh gosh, I don’t know how I didn’t see that. Thank you.