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

Tell us what’s happening:

I have tried all I could to solve this very challenge (step 155) I couldn’t. And I have been on it over 5 days now even with all the assistance I still could not pass it.

Am getting more confused as I have tried every step to pass it.

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[currentWeapon].name + ".";
  health -= getMonsterAttackValue(monsters[fighting].level);
  if   (isMonsterHit( ) && inventory.length !== 1) {
monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1;
} else {
text.innerText += " You miss.";
}
  healthText.innerText = health;
  monsterHealthText.innerText = monsterHealth;
  if (health <= 0) {
    lose();
  } else if (monsterHealth <= 0) {
    if (fighting === 2) {
      winGame();
    } else {
      defeatMonster();
    }
  }
  if (Math.random() <= .1) {
    text.innerText += " Your " + inventory.pop() + " breaks.";
    currentWeapon--;
  }
}

// User Editable Region

Your browser information:

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

Challenge Information:

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

You should add a second condition to this if statement. The example given in the challenge instructions demonstrates the use of the logical AND operator:

if (firstName === "Quincy" && lastName === "Larson")

Note that, in this case, the second condition which you add must use the strict inequality operator (as opposed to !=).