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

code 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

Hi 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));

It's also missing a semicolon from the var temperature = 37.5 initialization, 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.

Thanks that makes perfect sense.

Yeah, 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 :).

Well, 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. :)