I ran through pretty much all my options and now I don’t know what to do.Ive been stuck with this script for 2 days now. Is there something I’m missing?
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
function buyHealth() {
gold -= 10;
health += 10;
const gold=document.querySelector('#goldText');
goldText.innerText = gold;
const health=document.querySelector('#healthText');
healthText.innerText = health;
}
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Challenge Information:
Learn Basic JavaScript by Building a Role Playing Game - Step 76
You already have the healthText and goldText elements. You retrieved them in an way earlier step. Your gold and health variables hold the values those HTML elements display.
goldText.innerText = gold;
The point of this line was to display your current gold amount. Remove the reassignments and your code should work.
If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Help button located on the challenge. This button only appears if you have tried to submit an answer at least three times.
The Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.