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

Tell us what’s happening:

do i add dot notation inside the bracket here. I have read up on this but still a bit confused

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

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

// 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/124.0.0.0 Safari/537.36

Challenge Information:

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

1 Like

Hi there. In regards to dot notation, this challenge wants to you to retrieve the health property from the monster you’re currently fighting and assign to the predefined monsterHealth variable. The monster being stored at the fighting index inside of the monsters array is the current monster.

Hope this helps.

Here is an article with more examples on how to access properties from an array of objects

1 Like

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