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 trialHanane Ladj
Front End Web Development Techdegree Graduate 15,686 PointsNext, declare a new variable named tempRoundDown. Assign it the temperature variable rounded downward to the nearest int
would anyone help me with this challenge?
const temperature = 37.5;
let tempRounded = Math.round(temperature);
let tempRoundDown = Math.fround(tempRounded);
1 Answer
Rabin Gharti Magar
Front End Web Development Techdegree Graduate 20,928 PointsHey Hanane Ladj,
For the second challenge, you need to use Math.floor
method and assign it the temperature
variable instead of tempRounded
.
Here's the final code for the second challenge:
const temperature = 37.5;
let tempRoundDown = Math.floor(temperature);
To learn more about Math.floor()
method, check out this website: https://www.w3schools.com/jsref/jsref_floor.asp
Hope this helps!
Hanane Ladj
Front End Web Development Techdegree Graduate 15,686 PointsHanane Ladj
Front End Web Development Techdegree Graduate 15,686 PointsThank you so much! It works.