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

Tell us what’s happening:

I don’t know whats gone wrong here can someone please help.

Your code so far


The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

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"

Your browser information:

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

Challenge Information:

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

Please talk to us about how the error message or instructions are confusing. Thanks


Here are the instructions.

# Step 112

Add a new object to the end of the `locations` array, following the same properties as the rest of the objects. Set `name` to `"fight"`, `"button text"` to an array with `"Attack"`, `"Dodge"`, and `"Run"`, `"button functions"` to an array with `attack`, `dodge`, and `goTown`, and `text` to `"You are fighting a monster."`.

Have I not done the above?

You’re missing two small but crucial marks.

After the above object, you need a comma, remember you’re adding another item after it.

You miss a full top at the end of this text. The text should be copied as it is, do not remove spaces, marks… or add any.

I can read the instructions, but I can’t read your brain to know what you’re thinking!

This doesn’t look quite like correct syntax for an object. You should be getting an error message in the console talking about a missing or unexpected token.

1 Like