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

Tell us what’s happening:

what’s wrong in the following code :

function buyHealth() {
  gold -= 10;
  health += 10;
  const gold=document.querySelector('#goldText');
  const health=document.querySelector('#healthText');
}

Challenge Information:

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

1 Like

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.

Your goal is to set the innerText to the proper variables. Additionally goldText and healthText have already been defined for you.

Happy learning. :slight_smile:

2 Likes

thank you , I completely overlooked the previously defined goldtext and healthtext.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.