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

Tell us what’s happening:

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.

I keep getting a syntax error?

Your code so far

restart (
  xp = 0;
  health = 100;
  gold = 50;
  currentWeapon = 0;
  inventory = ["stick"];
goldText.innerText = gold;
healthText.innerText = health;
xpText.innerText= xp;
goTown ();
)

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

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

You have the wrong syntax for your function. This is the correct syntax.

function myFunction() {
    block of code
}

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