JavaScript JavaScript Numbers The Math Object Use Math Methods

Hanane Ladj
seal-mask
.a{fill-rule:evenodd;}techdegree
Hanane Ladj
Front End Web Development Techdegree Student 6,852 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

rabin
seal-mask
.a{fill-rule:evenodd;}techdegree
rabin
Front End Web Development Techdegree Student 14,513 Points

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!