Javascript Build Roleplay Game- Step 59

What am I missing?? I tried ChatGPT and Google.

Add a second object to your locations array (remember to separate them with a comma). Following the pattern you used in the first object, create the same properties but use the values from the goStore function. Set the name property to store

The results keep saying… "Your locations array should have two values. " I have two values separated by curly brackets.

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.”,
}
];

3 Likes

Nevermind. Figured it out. Thanks in advance

2 Likes

It’s a good idea to leave a solution for those who are stuck; in this code, objects should be separated by a comma.

Absolutely. Didn’t realize. Great point and yes it was the comma that I was missing.

1 Like

Can you put the entire solution please? I separated them with commas and it still doesn t work.

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”.”,
} , (you forget the comma)
{
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.”,
}
];

2 Likes

adding a comma after the closing of the first {} and before the opening of the second {}

I have added the comma and it still won’t pass.
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.”
}
];

This works for me:

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.”
}
];

Hi, solution posting is not allowed here on the forum