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 trialTiku Code
Courses Plus Student 869 Pointsi didn't understood the concept of Math.floor() & Math.ceil() .
According to the definition floor means downward so 1.2 should be 2 instead of 1 because it goes downwards and ceiling means top so 1.2 should be 1 right? cause it goes up, the heaviest element goes to the floor and the lighter ones goes to top...i hope you understood what i wanna say.
1 Answer
Steven Parker
231,236 PointsBy "downward" they mean "to a lower value". So the "floor" of 1.2 would be 1 since 1 is less than 1.2. For positive numbers, the "floor" function essentially just throws away any part after the decimal point.
Conversely, the "ceil" is the next higher whole number.