Step 114 - js(beta)

Hi, at this step I encounter “Your new object should have a name property set to fight.” & I have this
const locations = [
{
name: “fight”,
“button text”: [“Attack”, “Dodge”, “Run”],
“button functions”: [attack, dodge, goTown],
text: “You are fighting a monster.”
}, // other objects after

if it says “new object” I would guess it should go as last one in the array, but I wouldn’t know qithout seeing the step. Can you give the link to the step?

next time please use the Ask for help button

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

Hi Ilenia,

Ok, I’ll use Help, this is the link https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-basic-javascript-by-building-a-role-playing-game/step-114

I can’t see the error , in Visual Code it’s ok

Thanks & happy New Year !!!

@cristianmorar.m

Hey there,

The order of the objects should be exactly as shown below, so as to match the index of each object-element in the array accordingly.

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, goTown],
        text: "You are fighting a monster."
    }
];

Just make sure that you addedd the new object at the end of the array, thus making it the element with index 3(4th element) in the array.

Hope you progress to the next step. If the error still persists, post your code for better insights and let us help you through this step.

Happy Coding :keyboard: !

1 Like

Man…it was the order… :fearful: :face_with_head_bandage: Thank you so much !!!