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

why my code is not working even if I am trying to use Math.floor().
function defeatMonster() {
gold += Math.floor(monster[fighting].level * 6.7);
}

Your code so far

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

/* file: styles.css */

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

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

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

Challenge Information:

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

are you sure it doesn’t work? I just put your exact code into that challenge and it cleared just fine for me. Maybe try resetting that level and trying again.

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