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

It is saying i should " use the addition operator (+ ) to add a random number between 1 and the value of xp to your monsterHealth -= weapons[currentWeapon].power ."

is this how it should look like below

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge Information:

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

Hello @bright_develops !

You are very close to correct.

Check the operator being used to add

Is it the correct one ?

If you read your question, I think you will answer the question and move to the next step.

Wishing you good progress.

1 Like

wow thanks i was able to get the correct answer.
I really like that you did not just tell me the answer, hope i hear from you again

hello i have another problem please maybe i could use you help
it says that " In your defeatMonster function, set gold equal to gold plus the monster’s level times 6.7 . You can get the monster’s level with the level property."

please what am i doing wrong
function defeatMonster() {
gold += monsters[fighting].level * 6.7;
gold = Math.floor(gold) * 6.7;


Thanks in advance

You’re so close! You need to combine the two lines into one. So that you use once each the +=, the Math.floor, and the multiplication.

something like this
function defeatMonster() {
gold += monsters[fighting].level = Math.floor(gold) * 6.7;