Tell us what’s happening:
I don’t know what I’m missing here. Please Help me
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, run],
text: "You are fighting a monster."
}
];
// 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/122.0.0.0 Safari/537.36 Edg/122.0.0.0
Challenge Information:
Learn Basic JavaScript by Building a Role Playing Game - Step 112
// running tests Your
locations
array should have 4 values in it. Your new value should be an object. Your new object should have a
name
property set to
"fight"
. Your new object should have a
"button text"
property set to an array with the strings
"Attack"
,
"Dodge"
, and
"Run"
. Your new object should have a
"button functions"
property set to an array with the variables
attack
,
dodge
, and
goTown
. Your new object should have a
text
property set to
"You are fighting a monster."
. // tests completed // console output Uncaught ReferenceError: run is not defined [TypeError: Cannot read properties of undefined (reading ‘3’)] [TypeError: Cannot read properties of undefined (reading ‘3’)] [TypeError: Cannot read properties of undefined (reading ‘3’)] [TypeError: Cannot read properties of undefined (reading ‘3’)] [TypeError: Cannot read properties of undefined (reading ‘3’)]
I dont know what im doing wrong