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

Tell us what’s happening:

I am trying to add a compounded assignment but i am not sure where i am going wrong.

Your code so far

function sellWeapon() {
if (inventory.length > 1) {
gold += 15;
goldText.innerText = gold;
let currentWeapon = inventory.shift();
text.innerText+= "You sold a " + currentWeapon + “.”;
text.innerText+= " In your inventory you have: " +currentWeapon + “.”;
}
}

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/120.0.0.0 Safari/537.36

Challenge Information:

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

Hi there. You didn’t really didn’t need to modify the above innerText though you do seem to understand compound assignment.

You actually don’t have the currentWeapon. You sold it. In this challenge, you need to print out what you actually have in your inventory.

Happy learning. :slight_smile:

Hello, everything looks ok but the main issue I see is the spacinig between the quotes and + signs, most of the words need a space at the front of the string and back as well.

Add the inventory after the " In your inventory you have: ", and after this add the period put within the proper double quotes ( you have used invalid quotes).

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