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

Tell us what’s happening:

I have created the fifth locations array as instructed but my code is not passing. What might be the problem?

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

const locations = [
  {
    name: "town square",
    "button text": ["Go to store", "Go to cave", "Fight dragon"],
    "button functions": [goStore, goCave, fightDragon],
    text: "You are in the town square. You see a sign that says \"Store\"."
  },
  {
    name: "store",
    "button text": ["Buy 10 health (10 gold)", "Buy weapon (30 gold)", "Go to town square"],
    "button functions": [buyHealth, buyWeapon, goTown],
    text: "You enter the store."
  },
  {
    name: "cave",
    "button text": ["Fight slime", "Fight fanged beast", "Go to town square"],
    "button functions": [fightSlime, fightBeast, goTown],
    text: "You enter the cave. You see some monsters."
  },
  {
    name: "fight",
    "button text": ["Attack", "Dodge", "Run"],
    "button functions": [attack, dodge, goTown],
    text: "You are fighting a monster."
  },

   {
    name: "kill monster",
    "button text": ["Go to store", "Go to cave", "Fight dragon"],
    "button functions": [goStore, goCave, fightDragon],
    text: "The monster screams Arg! as it dies. You gain experience points and find gold."
  }
  
];

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0

Challenge Information:

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

It should be:
Mod Edit: solution removed

hi there!
do not post the full code solution.it is not allowed here on the forum. give only hints or suggetions.
@zeynep-0

Okay, sorry! Thanks for letting me know.

double check what it asks for this

It asks for

“Your fifth locations value should have a “button functions” array with three goTown
variables.” and that’s what we have in the town square locations array

It doesn’t look like your code matches the instructions at all, you don’t have even one goTown here

the town square one is the first element not the fifth, the fifth is kill monster

Thanks ilenia. It worked when i replaced all three with goTown for button functions.

1 Like