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

Tell us what’s happening:

I am not understanding why it’s giving me an error. It’s telling to follow the same syntax but when I do, it’s telling me “the array needs two objects”. I have tried to submit it step by step and as soon as I put in the ‘name’ value, it begins complaining about needing two objects in the array. I’m lost.

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": [
      (button1.onclick = buyHealth),
      (button2.onclick = buyWeapon),
      (button3.onclick = goTown),
    ],
    text: "You enter the store.",
  },
];

// 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/123.0.0.0 Safari/537.36

Challenge Information:

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

Do you see how name: “town square” and name: store are different colors here?

Screenshot 2024-04-14 193322

1 Like

The second object’s value should not be a variable…

Ahh, okay. I was thinking that looked strange. I’ll try that and see