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

Tell us what’s happening:

Instructions:

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

Your code so far

function attack() {
text.innerText = “The " + monsters[fighting].name + " attacks.”;
text.innerText += " You attack it with your " + weapons[currentWeapon].name + “.”;
health -= monster[fighting].level;
}

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 (Macintosh; Intel Mac OS X 10_15_7) 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 121

there is a typo in this line.

4 Likes

thx u very much, I stuck at this step for 3 days loll ;-;; (Since the question says Health equals Health minus Monster Level, I was fooled and thought it was a bug)

1 Like

I’m stuck in the same level and still can’t figure it out; what do you mean there’s a typo?

it mean there is a spelling mistake in the present code

2 Likes

Yeah that was frustrating to say the least. I kept seeing “monster” in the description/instructions and I couldn’t figure it out. Thank you!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.