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

Please explain me with the logic where i got stuck . I had provided acording to the given instructions but code is not passing
link : https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-basic-javascript-by-building-a-role-playing-game/step-129
insructions:
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.

Here is an example of setting num to num plus 5 * 8: num += 5 * 8. Use Math.floor() to round the result down.
//Mycode

function defeatMonster() {
gold += Math.floor(monster.level * 6.7);
//gold += Math.floor(monster[fighting].level * 6.7) (tried this way but not going)
}

err : You should use Math.floor() to round the result of the monster’s level times 6.7 .

Hey, You got it just add an s to monster. :slightly_smiling_face:

still stuck after adding s
`function defeatMonster() {
gold += Math.floor(monsters.level * 6.7 + gold);

}err: You should useMath.floor()to round the result of the monster's level times6.7` .
explain it please

Ok, I was referring to your comment line that should work.

1 Like

Thanks for help. Solved

1 Like

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