Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Numbers The Math Object Use Math Methods

I wish somebody can help me with this. I can not see my error and I am stuck. Thanks in advance.

script.js
const temperature = 37.5;

var tempRoundDown = Math.floor(temperature)

1 Answer

Dylan Anderton
Dylan Anderton
8,163 Points

A few things I notice here. I would double-check the variable name that you're declaring. It should be "tempRounded". As well, you're using Math.floor method which returns the largest integer less than or equal to x. I would try using Math.round which returns the value of the number x rounded to the nearest integer. Finally, don't forget to end with a semi-colon.

Let me know if you're still having the same issue.

const temperature = 37.5;

var tempRounded = Math.round(temperature);

var tempRoundDown = Math.floor(temperature);