Tell us what’s happening:
- Your second locations object should have a button text property which is an array.
- Your button text property should have the string values “Buy 10 health (10 gold)”, “Buy weapon (30 gold)”, and “Go to town square”.
- Your second locations object should have a button functions property which is an array.
- Your button functions property should have the function values buyHealth, buyWeapon, and goTown.
- You should not modify the first locations object.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
const locations = [
{
name: "town square",
buttonText: ["Go to store", "Go to cave", "Fight dragon"], // ✅ Correct property name
buttonFunctions: [goStore, goCave, fightDragon] // ✅ Correct functions
},
{
name: "store",
buttonText: ["Buy 10 health (10 gold)", "Buy weapon (30 gold)", "Go to town square"], // ✅ Correct property name
buttonFunctions: [buyHealth, buyWeapon, goTown], // ✅ Correct property name
text: "You enter the store." // ✅ This remains unchanged
}
];
// 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/134.0.0.0 Safari/537.36
Challenge Information:
Learn Basic JavaScript by Building a Role Playing Game - Step 59