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

Tell us what’s happening:

i was not getting what to add particularly in these Math.floor() and way of assigning it in the following code and was so confused while doing these and got no answer . can u please tell me how to assign it in the code.

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

function defeatMonster() {
  gold += Math.floor(Math.random() * 6 * 7) + 1;

// User Editable Region

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 127

The instructions they give are:
In your defeatMonster function, set gold equal to gold plus the monster’s level times 6.7 . Remember you can get the monster’s level by using monsters[fighting].level .

gold equal to gold plus would be:

gold +=

You add the monster’s level times 6.7, a decimal value, not times 6 then times 7 (as it currently is in your code) You also don’t need to add 1.

So it boils down to:

gold += Math.floor(monsterlevel * 6.7);

where monsterlevel is accessed using monsters[fighting].level in its place. You got this :grinning:
(monsterlevel is not the parameter, just something I put there to link it)