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

Tell us what’s happening:

health = monster[fighting].level -= health;

Your code so far

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

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

Challenge Information:

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

In step 121 they ask you to do this:

Next, set health to equal health minus the monster’s level. Remember you can get this from the monsters[fighting].level property.

You should add Subtraction assignment on the beginning not at the end.

This is my code and it is failing

health = health - monster[fighting].level;

The code check might be looking exactly and only for the use of “-=”.

1 Like

Hello @Arn345 !

To add to the other good guidance provided, there is a small typing error in the code.

We all do this at times. I do it often, unfortunately.

health = monster[fighting].level -= health;

Should it be monster or monsters before the bracket?

Wishing you good progress.