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

Step 45

You will also need to update the functions that run when the buttons are clicked again.

In your goStore() function, update the onclick property for each button to run buyHealth, buyWeapon, and goTown, respectively.

Unable to solve the above problem.

Let’s see your code. :slightly_smiling_face:

function goStore(){
button1.innerText = “Buy 10 health (10 gold)”;
button2.innerText = “Buy weapon (30 gold)”;
button3.innerText = “Go to town square”;
button1.onclick = buyHealth;
button2.onclick = buyWeapon;
button3.onclick = goTown;
}

function goStore(){
button1.onclick = buyHealth();
button2.onclick = buyWeapon();
button3.onclick = goTown();
}

This is the solution. Thank You!