it say i should use set the monsterHealth to be the health of the current monster. You can get this value by accessing the health property of monsters[fighting] with dot notation. set the monsterHealth to be the health of the current monster. You can get this value by accessing the health property of monsters[fighting] with dot notation.
and i have tried different option it not working , please can someone help me out, Thanks in advance
function goFight() {
update(locations[3]);
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Challenge Information:
Learn Basic JavaScript by Building a Role Playing Game - Step 116
monsters[fighting].health
monsters is an array of objects
you access the current monster object which is the value of fighting
you access the health value within this object with .health
const monsters = [
{ name: ‘slime’, level: 2, health: 15 },
{ name: ‘fanged beast’, level: 8, health: 60 },
{ name: ‘dragon’, level: 20, health: 300 }
[Below your update call, set the monsterHealth to be the health of the current monster. You can get this value by accessing the health property of monsters[fighting] with dot notation.] i don’t really understand what to do.
This is the code below