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

Tell us what’s happening:

This is my code:
goldText.innerText = Gold: ${gold};
healthText.innerText = Health: ${health};

I have made numerous google searches and quite seem to appear to make the correct answer. Please can someone help me make the correct answer to extend to no more than two lines.

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

function buyHealth() {
  gold -= 10;
  health += 10;

}

// User Editable Region

Your browser information:

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

Challenge Information:

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

Hi @fitzgeraldp

You do not need to use template literals.
You also do not need to include the text.

goldText.innerText = `Gold: ${gold}`;
healthText.innerText = `Health: ${health}`;

Happy coding

Hi Teller

Can you please elaborate more on what you mean?

Cheers

For this step you can assign just the variable to the .innerText property.
If you look at the preview, the text for Gold and Health are already on the page.

1 Like

Am I getting close? I am still a little confused by what you mean. I am almost there.
gold.innerText = "Gold: ${“Go to store”};
health.innerText = "Health: ${“Buy Health”;

Look forward to your reply

After your assignment lines, assign the innerText property of goldText to be the variable gold. Use the same pattern to update healthText with the health variable.

You must do only what this says and absolutely nothing more.

This assignment is not what the instructions ask for. It needs to a variable.

No need to include any text or template literal syntax.

Same goes for the other assignment.

Happy coding

Thank you so much I managed to reword and come up with the answer.

1 Like

I was stuck too, but looking at your code saved me from the pain.

1 Like