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

Tell us what’s happening:

In my mind, I have completed the task. What am I missing?

Your code so far

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


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/ Safari/537.36

Challenge Information:

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


You are adding another gold value in the Math.floor() function. You don’t need to do that, gold is already added and abstracted away with +=. Remove “gold” from the calculation and you will pass.

1 Like

1Hell I spent 1 hour on this yesterday and gave up. Thanks for that!

1 Like

When you are new to programming, the challenge can be a lot to take in.

Shortened syntax like gold += that actually stands for gold = gold + ( x ) as one thing to learn. Until you are familiar with the abstractions, it can sometimes help to write the full syntax out.