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

Tell us what’s happening:

I am lost on what to do

I have tried to follow the instructions, but I still am not clear on where I’m going wrong

Your code so far

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

/* file: styles.css */

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

function buyHealth() {
  gold -= 10;
  health += 10;
  goldText.innerText = gold;
  healthText.innerText = health;
  if (gold >= 10) {console.log ()}
}

if (gold >= 10) {
  gold -= 10;
  health += 10;
  goldText.innerText = gold;
  healthText.innerText = health;

}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0

Challenge Information:

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

Please talk to us about how the instructions are confusing. Thanks

You have modified your code. You only need to add if statement around you existing buyHelath function code with condition gold >= 10.
Reset your challenge and try again.

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.