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

Tell us what’s happening:

Your code so far

text.innerText = "You now have a " + newWeapon+ “.”; }

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

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

Challenge Information:

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

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

it was simple concatenation for the update of the new weapon

Can you post your buyWeapon function this way:

```
your function here
```

function buyWeapon() {
if (currentWeapon < weapons.length - 1) {
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;
} else {
text.innerText = “You do not have enough gold to buy a weapon.”;
}
} else {
text.innerText = “You already have the most powerful weapon!”;
button2.innerText = “Sell weapon for 15 gold”;
button2.onclick = sellWeapon;
}
}

I think you passed the step you created this topic about? because this has statements that mentioned after this one. But your code passes for me and is working, if you are not passing try another browser, clear cache or disable extensions that you think may cause issues.

Note in the beginning of javaScript course:

Note: Some browser extensions, such as ad-blockers and script-blockers can interfere with the tests. If you face issues, we recommend disabling extensions that modify or block the content of pages while taking the course.

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