"WordPress Basics" was retired on July 6, 2019.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed JavaScript Numbers!
You have completed JavaScript Numbers!
JavaScript lets you create random numbers, which you can use to add variety and surprise in your programs. You generate a random number in JavaScript via a method named Math.random().
Resources
Example Return Values
Math.floor() | Return Value | Math.ceil() | Return Value |
---|---|---|---|
Math.floor() |
Math.ceil() |
||
Math.floor(1.2) |
1 |
Math.ceil(1.2) |
2 |
Math.floor(0.0012) |
0 |
Math.ceil(0.0012) |
1 |
Math.floor(5.028) |
5 |
Math.ceil(5.028) |
6 |
Math.floor(2) |
2 |
Math.ceil(2) |
2 |
Math.floor(0) |
0 |
Math.ceil(0) |
0 |
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up