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 trialRossana Godfrey
11,759 PointsHi guys, I honestly do not know what is wrong here. Thanks
const temperature = 37.5;
var tempRounded = Math.round(temperature)
const tempRoundDown = Math.floor(tempRounded)
3 Answers
Dylan Anderton
8,163 PointsA 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.
Quoted from your other post...
const temperature = 37.5;
var tempRounded = Math.round(temperature);
var tempRoundDown = Math.floor(temperature);
Rossana Godfrey
11,759 Pointsthank you Dylan. I was able to run the code with your help.
Dylan Anderton
8,163 PointsAwesome! Glad I could help!
Rossana Godfrey
11,759 Pointsyou are right Dylan. I actually, omitted part of the code by mistake in the first question but still my code is not running. I used Math.round and it worked for the first part of the challenge but when I used Math.floor for the last part is not working and I am using the same logic. Any hint?
Dylan Anderton
8,163 PointsYou forgot your ";" at the end of each variable you're declaring. As well, you will want to use "var" and not "const". I would copy my code and give it a shot. Let me know.