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

Tell us what’s happening:

I have called the defeatMonster function but it keeps telling me to call it and my code is refusing to pass.

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;
  monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1;
  healthText.innerText = health;
  monsterHealthText.innerText = monsterHealth;
  if (health <= 0) {
    lose();
  } else if (monsterHealth <= 0) {
   function defeatMonster() {} ;
  };
}

// 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/138.0.0.0 Safari/537.36

Challenge Information:

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

this is not how you call a function, this is a function definition

please how do i call the function

please review the other functions you have used so far, or review this lecture https://www.freecodecamp.org/learn/full-stack-developer/lecture-working-with-functions/what-is-the-purpose-of-functions-and-how-do-they-work

I have called the function and the code is still not passing :smiling_face_with_tear:

please, post your updated code when you need more help, I ask you every time

 function defeatMonster() {
  console.log("");
}

defeatMonster();
  };

and where have you add this?

in the next line of code

in the next line of code respect to what?

please reset the step, do not define defeatMonster, just call it