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 trialAlex Lang
1,110 Pointsso basically can someone explain math.random and math.floor?
Just need some explaining on this, I never got how those worked
3 Answers
KRIS NIKOLAISEN
54,971 PointsMDN on Math.random and Math.floor
DeMarcus Surgers
1,733 PointsThe Math.floor() function returns the largest integer less than or equal to a given number. So for instance Math.floor(3.2) will return 3. Not to get too confusing, anything in the 3 range will return turn so Math.floor(3.9) will still return 3. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new
Ben Hernandez
3,578 PointsMath.random returns a floating-point number between 0 and 1. It includes 0, but not 1.