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 JavaScript Numbers The Math Object Use Math Methods

Hanane Ladj
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Hanane Ladj
Front End Web Development Techdegree Graduate 15,686 Points

Next, declare a new variable named tempRoundDown. Assign it the temperature variable rounded downward to the nearest int

would anyone help me with this challenge?

script.js
const temperature = 37.5;


let tempRounded = Math.round(temperature);
let tempRoundDown = Math.fround(tempRounded);

1 Answer

Hey 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!