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

Tell us what’s happening: I am supposed to use the += operator to add text to the end of text.innerText .

Your code so far

  if (gold >= 30) {
    gold -= 30;
    currentWeapon++;
    goldText.innerText = gold;
    let newWeapon = weapons[currentWeapon].name;
    inventory.push(newWeapon);
    const additionalText = ' In your inventory you have: ' + inventory ;
    text.innerText += additionalText;
      
  }
}

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.

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) 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 93

Welcome back to the forum @kennethkigano !

Suggestion: Reset the step. Do not change any of the provided code.

This is on the right track. But, it needs to have the correct text added. As well, it is important to leave spaces where necessary to prevent the added text from merging with the text before or after it.

Wishing you good progress.

Hi still doesn’t work after reset here is the the code snippet

    const additionalText = '   In your inventory you have:  ' + inventory ;
    text.innerText += additionalText;
      ```

And here is the error — Sorry, your code does not pass. You’re getting there.

You should add a new line with text.innerText.

Hi @kennethkigano! You’re so close! In fact you’ve passed it! Step 93 doesn’t ask you to add the variable inventory yet. That’s step 94! I think you’ll get it now. :slightly_smiling_face: