Tell us what’s happening:
why am i getting the following message on my code;You should add to the weapons[currentWeaponIndex].power value.
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
monsterHealth -= weapons[currentWeaponIndex].power;
const random = math.floor(mather.random() * xp) + 1;
weapons[currentWeaponIndex].power += random;
// 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/126.0.0.0 Safari/537.36
Challenge Information:
Learn Basic JavaScript by Building a Role Playing Game - Step 124
ILM
2
because you have syntax issues like this one
and this one
it’s Math
, not math
or mather
also you should not create a new variable
why am i getting this message on my code;You should add to the weapons[currentWeaponIndex].power value.
ILM
4
you need to add to this line as instructed
use the addition operator (+
) to add a random number between 1
and the value of xp
to your monsterHealth -= weapons[currentWeaponIndex].power
.
1 Like
i’m not getting please explain further
ILM
6
you need to write +
and the code to get the random number on that line, so it’s part of calculating how much damage the monster get
what does the following sentence mean; You should use the same monsterHealth
line you already wrote.
1 Like
ILM
8
this one was already written at the start of this step, continue working on this line, do not add other lines