Why is It giving me this error?!

I am doing the JS course and I am stuck on this problem.

Why is it giving me a “Math is not defined at Object,” error?


Thanks for any help.

Shouldn’t it be math.floor(), rather than Math.floor …?

This post was flagged by the community and is temporarily hidden.

Your response doesn’t even address the error.

1 Like

if you run the code i gave you, you’ll see that it works and there are no errors outputted to console.

they spelled “fahrenheit” the same way throughout the code. that’s not the issue.

1 Like

@lisalisaj, you’re on the right track, but Math.floor() is correct. The issue I see is that the error is not for the code in the code editor. The error message states that math is not defined because it isn’t. The module is named Math. For that message to be there, the code on line 8 had to originally read:
fahrenheit = math.floor(fahrenheit); as shown in the error message. The code as shown in the editor should run without error.


Ah yep. I figured it was a module error.

1 Like

Giving folks AI generated responses that fail to address the problem is not helpful.

The problem had nothing to do with the spelling of a variable, and there was nothing wrong with the backticks.


Thank you all so much!

So from what I am gathering, The code is correct (even though it is misspelled) but the module is broken?

I sincerely appreciate it.

No. The module is fine, but you have to spell it properly. Math.floor() is correct. The error shows that the code on line 8 had math.floor() originally. If you run the code that is shown in your screenshot, it should work. You may have to save it first. I can’t tell from your screenshot if it is an exercise where the button reads Save or Run, or what you do to run the code, but as long as the code in your screenshot is run with Math.floor() rather than math.floor() it should be fine.

I just looked at the exercise. The Save button also runs the code, so it looks as though you changed the spelling of math to Math after clicking Save, and then took the screenshot without having run the corrected code.

1 Like