function buyWeapon() {
if (gold >= 30) {
gold -= 30;
currentWeapon++;
goldText.innerText = gold;
let newWeapon = weapons[currentWeapon].name;
text.innerText = "You now have a " + newWeapon + “.”;
arr.push(newWeapon);
}
} Back at the beginning of this project, you created the inventory array. Add the newWeapon to the end of the inventory array using the push() method.