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

Tell us what’s happening:

No se cual es el problema. necesito ayuda.

Your code so far

Up until now, any time text.innerText was updated, the old text was erased. This time, use the += operator to add text to the end of text.innerText.

Add the string In your inventory you have: - include the spaces at the beginning and the end.

function buyWeapon() {
  if (gold >= 30) {
    gold -= 30;
    goldText.innerText = gold;
    let newWeapon = weapons[currentWeapon].name;
    text.innerText += "You now have a " + newWeapon + "." , 
    "In your inventory you have:" ;

Your browser information:

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

Challenge Information:

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

You used the + sign to concatenate the first three strings but then you used the , to add on the last string. Is there a reason you did this?

si ese es el problema. esa es la parte del codigo que no pasa.
pero probe sin la coma y no pasa tampoco.

You will need to paste your updated code (without the comma) in here so we can see what you did. Please use the following method to paste your code in here.

To display your code in here you need to wrap it in triple back ticks. On a line by itself type three back ticks. Then on the first line below the three back ticks paste in your code. Then below your code on a new line type three more back ticks. The back tick on my keyboard is in the upper left just above the Tab key and below the Esc key. You may also be able to use Ctrl+e to automatically give you the triple back ticks while you are typing in the this editor and the cursor is on a line by itself. Alternatively, with the cursor on a line by itself, you can use the </> button above the editor to add the triple back ticks.

1 Like

No es tan complicado, solo tienes que agregar una nueva línea text.innerText, agregarle += y la cadena. Recuerda agregar los espacios.