What is happening

if() {

how do i call the isMonsterHit as condition

You’re not checking anything here? You need to check for something in the if statement that will result in the if condition being true or false depending on your logic if you want the function to be called. You will need to explain a lot more, and share all your code on what you are doing

If you are working on a challenge its best to follow the below to ask questions about your code

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

1 Like

Function names that start with is or has conventionally return a boolean value. As such, you can use the return value from the function call in a condition simply by calling the function.


function isEven(number) {
  return number % 2 === 0;

if (isEven(10)) {
  console.log("The number is even"); // The number is even
1 Like
function attack() {
  text.innerText = "The " + monsters[fighting].name + " attacks.";
  text.innerText += " You attack it with your " + weapons[currentWeaponIndex].name + ".";
  health -= getMonsterAttackValue(monsters[fighting].level);

  monsterHealth -= weapons[currentWeaponIndex].power + Math.floor(Math.random() * xp) + 1;
  healthText.innerText = health;
  monsterHealthText.innerText = monsterHealth;
  if (health <= 0) {
  } else if (monsterHealth <= 0) {
    if (fighting === 2) {
    } else {
} if(isMonsterHit()) {

I am calling the function but nothing is happening. I tried to use the example you provided but I think Im missing something

it doesn’t look in the right place, that is outside the attack function. Where are you asked to put it instead?

I saw where i was going wrong. Thank you