JavaScript JavaScript Numbers The Math Object Use Math Methods

Hanane Ladj
Hanane Ladj
Front End Web Development Techdegree Student 12,773 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?

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:

Hope this helps!