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

Step 57

Create another property in your object called button functions. Give this property an array containing the three functions assigned to the onclick properties in the goTown function. Remember that these functions are variables, not strings, and should not be wrapped in quotes.

(Here’s my code)

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

function goTown() {
  button1.innerText = "Go to store";
  button2.innerText = "Go to cave";
  button3.innerText = "Fight dragon";
  button1.onclick = goStore;
  button2.onclick = goCave;
  button3.onclick = fightDragon;
  text.innerText = "You are in the town square. You see a sign that says \"Store\".";

When I hit Ctrl + Enter or click on the button for “Check your code”, nothing happens at all. What am I doing wrong? I’ve tried button functions without quotation marks, I’ve tried buttonFunction, I’ve tried "buttonFunctions" and I’ve consulted ChatGPT which has no clue why I’m not able to move on as it thinks my code is fine. Is this a bug in the beta?

Remember object properties are separated by a comma


AHA! You are a Gentleman and a Scholar! Thank you!!!

type or passe code here


  1. This text will be hidden

really thank you so much i come here just now and i was facing the same problem, thanks a lot bro

god i feel so dumb looking at this because i had the same problem :sweat_smile: