Hello, I need some clarification - I had finally passed this step of the challenge but I am a little confused on my error.
This is the instructions:
At the end of your code, create a restart
function. Inside this function, set xp
to 0
, health
to 100
, gold
to 50
, currentWeapon
to 0
, and set inventory
to an array with the string stick
.
Also update the innerText
properties of goldText
, healthText
, and xpText
to their current values.
Finally, call the goTown()
function.
MY code (I eliminated the first portion of my code so that I am not posting the solution.):
function restart() {
xpText.innerText = xp;
function goTown() {
}
}
My confusion is on the part where it is asked to call the goTown function. I am confused why I must code it as “function goTown ()” rather than just “goTown()” since it has already been declared in previous steps.