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

function attack() {
  text.innerText = "The " + monsters[fighting].name + " attacks.";
  text.innerText += " You attack it with your " + weapons[currentWeapon].name + ".";
  let lastItem = inventory.pop();
  text.innerText +=  " Your " + lastItem ;
  health -= getMonsterAttackValue(monsters[fighting].level);
  if (isMonsterHit()) {
    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) {

  }
}

The text says “” Use the += operator to add " Your <weapon> breaks." , with a space in front of Your , to the end of text.innerText . Replace <weapon> with the last item in the inventory array using inventory.pop() , which will remove the last item in the array AND return it so it appears in your string.“”

let lastItem = inventory.pop();
  text.innerText +=  " Your " + lastItem ;

This is where i am stuck

Your browser information:

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

Challenge Information:

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

Dont use a new variable, just put in the inventory.pop() directly and dont forget the next word after this.