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

Tell us what’s happening:

What’s the monsterHealth variable? I’ve tried several combinations and still I can’t solve it. I need some help.

### 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.

function goFight() {
  update(locations[3]);
  monsterHealth = monsters[fighting];
}

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 OPR/105.0.0.0

Challenge Information:

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

Hello, your very close to solving this, all that is missing is .health

Generative AI is experimental. Learn more

In JavaScript, dot notation is a way to access the properties of an object. For example, if you have an object called person with a property called name, you would access the name property using person.name.

You can also use dot notation to call methods on an object. For example, if you have an object called calculator with a method called add, you would call the add method using calculator.add().

Dot notation is a very convenient way to access the properties and methods of objects. It is also very easy to read and understand.

2 Likes

You can get this value by accessing the health property of monsters[fighting] with dot notation.

Need to add this part

1 Like

Solved. Thank you so much for the feedback!

1 Like

Thank you for mentioning this, it was very helpful too!

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