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 trialRachel Heneault
Courses Plus Student 766 PointsI keep getting this question wrong, is Math.round?
On the quiz doing the fill in the blank.
5 Answers
Per Karlsson
12,683 PointsHey Rachel,
Try using Math.floor instead and see if it works better for you :)
Mustafa Dilaver
12,671 PointsQuestion
Complete the following code so that the results of this math operation are rounded down to the nearest integer. For example, .6 will be rounded to 0.
To round down numbers in JS you need to use Math.floor() method.
Diptayan Basak
2,686 PointsThe question says "rounded down to the NEAREST integer". Math.round() automatically rounds it to the nearest integer. Then the second part says that if it is 0.6 then it should be rounded to 0 in which case we should use Math.floor(). I think the question is not clear and need to be rephrased to remove the word "nearest", until then, Math.round() is a right answer.
August Oliver
5,934 PointsThe answer is: Math.floor( 5 / 2)
Dereje Dessalegn
2,408 PointsMath.floor(5 / 2) ;
Rachel Heneault
Courses Plus Student 766 PointsRachel Heneault
Courses Plus Student 766 PointsDuh. Just realized. Wow. Thank you.