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

Hi

I tried to do this but not too sure what they want here but gave it a go thanks for all your help in advance as when i was doing html , css , sql etc i picked that up easier than all this but getting there slowly but surely learning something everday ,everyday is a school day.

Thanks

Ian

Your code so far

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

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

Challenge Information:

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

const weapons = [name=“stick”, “dagger”, “claw hammer”, “sword”,;

power=5, 30, 50, 100;

The requirements say:

Step 80

Just like your locations array, your weapons array will hold objects. Add four objects to the weapons array, each with two properties: name and power. The first should have the name set to "stick" and the power set to 5. The second should be "dagger" and 30. The third, "claw hammer" and 50. The fourth, "sword" and 100.

It makes reference to a previous locations array that you can look at. Here it is.

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

Now, if we clean it for the sake of understanding it might look like this:

const locations = [
  {
    name: "town square",
  },
  {
    name: "store",
  },
  {
    name: "cave",
  }
];

I’ll say try to imitate what you see there with what it is asking.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.