Learn Basic JavaScript by Building a Role Playing Game Step 93

help me to compleet this code:
my code:

function buyWeapon() {
  if (gold >= 30) {
    gold -= 30;
    currentWeapon++;
    goldText.innerText = gold;
    let newWeapon = weapons[currentWeapon].name;
    text.innerText = "You now have a " + newWeapon + ".";
    inventory.push(newWeapon);
    text.innerText += " In your inventory you have: " +;
}

challenge: Learn Basic JavaScript by Building a Role Playing Game Step 93

You need to add the contents of inventory to text.innerText:

text.innerText += " In your inventory you have: " + inventory;
    it is not worked

function buyWeapon() {
  if (gold >= 30) {
    gold -= 30;
    currentWeapon++;
    goldText.innerText = gold;
    let newWeapon = weapons[currentWeapon].name;
    text.innerText = "You now have a " + newWeapon + "." + inventory;
    inventory.push(newWeapon);
    text.innerText += " In your inventory you have: " + 
function buyWeapon() {
  if (gold >= 30) {
    gold -= 30;
    currentWeapon++;
    goldText.innerText = gold;
    let newWeapon = weapons[currentWeapon].name;
    text.innerText = "You now have a " + newWeapon + "." + inventory;
    inventory.push(newWeapon);
    text.innerText += " In your inventory you have: " + inventory;
}
}



This code will not work, because you are trying to declare the same function twice:

I know this question has been marked as solved, but I’d like to clean it up for anyone else who looks up this problem.

So the buyWeapon() function should look like:

function buyWeapon() {
  if (gold >= 30) {
    gold -= 30;
    currentWeapon++;
    goldText.innerText = gold;
    let newWeapon = weapons[currentWeapon].name;
    text.innerText = "You now have a " + newWeapon + ".";
    inventory.push(newWeapon);
    text.innerText += " In your inventory you have: " + inventory;
  }
}

I hope this helps.