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

Tell us what’s happening:

Can’t seem to find what is wrong with these codes…

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 Town Square", "Go To Town Square", "Go To Town Square"],
    "button functions": [GoTown, GoTown, GoTown],
    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/131.0.0.0 Safari/537.36

Challenge Information:

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

You haven’t followed these instructions exactly. Check that all capitalisation matches:

Add a new object… set "button text" to an array with three "Go to town square" strings, set "button functions" to an array with three goTown variables…

{
    name: "kill monster",
    "button text": ["Go To Town Square", "Go To Town Square", "Go To Town Square"],
    "button functions": [GoTown, GoTown, GoTown],
    text: "The monster screams Arg! as it dies. You gain experience points and find gold."
  }

I see that each time you write more or less the same thing. You could try to start talking about your code. It’s a really useful skill to have!

I checked the capitalization , it still doesn’t seem to work

and did you change the things with the wrong capitalization?

the wrong capitalization has been changed

and what is your code now?

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 town square", "Go to town square", "Go to town square"],
    "button functions": [GoTown, GoTown, GoTown],
    text: "The monster screams Arg! as it dies. You gain experience points and find gold."

  }
];

You did not change the wrong capitalization, or at least not all of it

Go to town square if i am not mistaken

no    

Interesting, that worked, what do you mean by talk about your codes by the way…

talk about it. Explain what you changed, why you think it should work, what error you get, what you not understand of the error etc

Sometimes the question is just I did everything the question asked for but cant seem to figure out whats wrong, like this one…

That is not an excuse, you must learn to talk about your code.

Example:

This step asks that I add a new object to locations, so I added , {} to the array; with a name property set to "kill monster", so I added name: "kill monster" to the object. With a button text property set to an array with three "Go to town square", so I added "button text": ["Go To Town Square", "Go To Town Square", "Go To Town Square"].

You may have noticed the issue on your own, you know?

Interesting…

I just added some description for a question on step 136, what do you think about that?