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
aidencornwell
8,583 Pointscode challenge bug javascript basics math
Appears to be a bug since I think my answer is correct
var temperature = 37.5 alert(Math.round(temperature)); alert(Math.roundfloor(temperature));
1 Answer
Greg Kaleka
39,021 PointsHi Aiden,
Your second rounding statement isn't using the correct method. You want Math.floor(). Math.roundfloor() doesn't exist :).
var temperature = 37.5
alert(Math.round(temperature));
alert(Math.floor(temperature));
Marcus Parsons
15,719 PointsMarcus Parsons
15,719 PointsIt's also missing a semicolon from the
var temperature = 37.5initialization, although it isn't necessary as long as the lines are formatted as you have them. I don't know if the challenge would pick up on that or not.aidencornwell
8,583 Pointsaidencornwell
8,583 PointsThanks that makes perfect sense.
Greg Kaleka
39,021 PointsGreg Kaleka
39,021 PointsYeah, Marcus Parsons, I noticed that, too, but it turns out that text is pre-populated in the code challenge! Can't hold that against him :).
Marcus Parsons
15,719 PointsMarcus Parsons
15,719 PointsWell, there's no link to this challenge from this question, and because of such, I have no idea what text is pre-populated or not lol. Regardless, it's still a valid remark. :)