Step93 You should add a new line with text.innerText

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: " + “\n” + text.innerText;
}
}
Please Help to fix above code of line because It not passing, It is giving below error
You should add a new line with text.innerText .

Welcome to the forum @jaiminpanchal

This part of the code is not needed so can be removed.

The instructions asked you to include a space at the start of the new string.

Happy coding

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: ";

}
}

1 Like

did you find the answer ?

Yes I find the answer

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.