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

Tell us what’s happening:

I’m confused as to why it is asking for another “text.innerText” line. Im pretty sure I did what I was supposed to.

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 now have: ";
text.innerText = inventory;
  }
}

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

It looks like you have a couple of issues here

You need a space in front of this word here

You need to remove this line completely because it is setting the entire text to just the inventory which is not what you want to do

at the end of this line, you need to use the + operator concatenate the inventory

once you fix those things, then the test will pass

3 Likes

Thank you, it took some trying but I got it.

2 Likes