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
.