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 trialSahmad Nakumbe
3,423 PointsFor this Code Challenge you need to use JavaScript's Math methods. Declare a new variable named tempRounded. Assign it
const temperature = 37.5;
tempRounded(Math.round(temperature));
9 Answers
Chidiebere Ekennia
5,950 PointsThere's a few bugs in your code Sahmad. First, You needed to declare tempRounded as a variable using either the "let" or "var" keywords. Second, You make a little mistake by in the last line of code. There's a syntax error there. It should have been: let tempRounded = Math.round(temperature); Hope this helps
kkellerman
15,633 Pointsconst temperature = 37.5;
const tempRounded = Math.round(temperature);
const tempRoundDown = Math.floor(temperature);
jlampstack
23,932 Pointsconst temperature = 37.5;
let tempRounded = Math.round(temperature);
let tempRoundDown = Math.floor(temperature);
Hi Sahmad, Thanks for inviting me to this challenge. I feel I have a good understanding of JavaScript but even so a quick little Google search helped. W3Schools is an excellent resource. Hope this helped.
https://www.w3schools.com/jsref/jsref_obj_math.asp
PS. The question asks you to store it as a variable. You were very close, you only forgot to assign the variable.
Shanna vick-Morris
6,683 Pointsconst temperature = 37.5;
let tempRounded (Math.round(temperature));
the error I am getting is unexpected token
Sahmad Nakumbe
3,423 PointsThank you! Chidiebere Ekennia, jlampstack
Sahmad Nakumbe
3,423 PointsShanna const temperature = 37.5; let tempRounded (Math.round(temperature));
Sahmad const temperature = 37.5; let tempRounded = Math.round(temperature);
Shanna vick-Morris
6,683 PointsI am still getting an unexpected token error. Maybe it's the system?
ellie adam
26,377 Pointsconst temperature = 37.5;
let tempRounded = Math.round(temperature);
let tempRoundDown = Math.floor(temperature);
Kajuanna Smith
Full Stack JavaScript Techdegree Graduate 13,609 Pointslet tempRounded = Math.round(temperature);
let tempRoundDown = Math.floor(temperature);
David Patrick
6,067 PointsAnswer: let tempRounded = Math.round(temperature);
Michael Ajayi
5,602 PointsMichael Ajayi
5,602 PointsThanks