Step 56 - Learn JavaScript By Building A Role Playing Game

Hi there,
i believe i am following right instructions but i am not getting feedback when i submit the code.

const locations = [
  {
    name: "town square",
    "button text": ["Go to store", "Go to cave", "Fight dragon"]
    "button functions":[goStore, goCave, fightDragon]
  }
];```

each property: value needs to end with a comma, you are missing one

at the end of fightDragon?

here you have a property value that is an array and no comma after it

i tried it but it doesn’t work

const locations = [
  {
    name: "town square",
    "button text": ["Go to store", "Go to cave", "Fight dragon"]
    "button functions", :[goStore, goCave, fightDragon]
  }
];

you have not added the comma , there is no comma after the array

const locations = [
{
// The object within the locations array represents a location in a game.
// It contains the name of the location and buttons with associated actions.
name: “town square”,
// The property “button text” should be separated by a comma from the previous property.
// Also, property names should not have spaces, consider renaming to buttonText.
buttonText: [“Go to store”, “Go to cave”, “Fight dragon”],
// Similarly, “button functions” should be separated by a comma and renamed to buttonFunctions.
// Ensure that functions like goStore, goCave, and fightDragon exist.
buttonFunctions: [goStore, goCave, fightDragon]
}
];
Here is the correct version of the code:

Mod Edit SOLUTION REMOVED

i tried yours and it didn’t work

The code block you provided had some errors. I’ve just fixed them. If this doesn’t work, that means you have problem in your other codes.

this is what i have

const locations = [
  {
    name: "town square",
    "button text": ["Go to store", "Go to cave", "Fight dragon"],
    button_functions: [goStore, goCave, fightDragon],
  }
];```

the message i get is - 
Your first locations object should have a button functions property.

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

You have two syntax errors here button_functions:

the property name should be "button functions" as instructed

i have updated that

const locations = [
  {
    name: "town square",
    "button text": ["Go to store", "Go to cave", "Fight dragon"],
    button functions: [goStore, goCave, fightDragon],
  }
];

you are missing the quotes

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