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

Help me to get out of this situation . i had tried alot but not getting out of this situation
Following this pattern, use the addition operator (+ ) to add a random number between 1 and the value of xp to your monsterHealth variable change.

function attack() {
  text.innerText = "The " + monsters[fighting].name + " attacks.";
  text.innerText += " You attack it with your " + weapons[currentWeapon].name + ".";
  health -= monsters[fighting].level;
  monsterHealth += weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1;
  }

this error is coming again and again You should add to the weapons[currentWeapon].power value.

Please post a link to the Step. Thanks

Here’s the link

hi, is -=

monsterHealth -=

where i can add this explain lilltle bit in which logic . where i got stuck.Thanks

instead of:

monsterHealth += weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1;

u have to use

Mod Edit: SOLUTION REMOVED

this is because the exercise ask u to add to what u already have the Math.floor function, but not change anything from before

Thank you . i got it.

no problem, nice to help ^^

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

oh okay, thanks for helping, i will be more careful

That would be a great bug.

Every time you hit the monster it gets stronger and stronger. I’m sure I wouldn’t rage quit that game at all.