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

Tell us what’s happening:

I can’t figure out what i need to do.

Your code so far

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) {
     function lose()


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.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

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

Challenge Information:

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

Hey @pdro996, and welcome to the FCC Community!

Whenever you hear the term “call a function”, it doesn’t mean create the function there. It’s asking you to execute the function at that location. Whenever you put “function” before a function name, JS thinks you want to start a brand new function there.

If I have a function called win, and I want to call it if my health is greater than 100, I would do it like so:

if (health > 100) {

All you need to do is apply that same methodology to this challenge.

1 Like

Wowww. Thank you very much.