i use innnertext property and write the line in string but still i got error anyone help me !!!
### 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:";
}
}
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
Now use the += operator to add the string In your inventory you have: and the contents of inventory to the text.innerText . Make sure to include the space at the beginning and end of the In your inventory you have: string.
You should include the contents of your inventory and also the spaces specified in the instructions.
text.innerText = "You sold a " + currentWeapon + “.”;
text.innerText += " In your inventory you have: " + inventory;
imo …it’s Worth mentioning … text.innerText is on a new line… not added to the end of the first text.innerText. The lesson doesn’t say the += joins the new line to the one above it. tripped me up, as I originally tried to add it to the same line… the directions say " add the string to the text.innerText." … doesn’t say… ok, now on a new line add another text.innerText… etc…