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!
Preview
In addition to the arithmetic operators you learned, JavaScript has a built-in `Math` object used to perform complex mathematical operations on numbers.
Resources
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
Applications often need a way to provide
users random choices or outcomes.
0:00
Generating random numbers
comes in handy for
0:04
games or anytime you want to make
your program less predictable.
0:06
For example, in a dice or
card game, each dice roll or
0:10
card shuffle might result in a different
outcome that's randomly generated.
0:13
You create random numbers in JavaScript
using what's called the math object.
0:17
Even though you've already
worked with objects,
0:21
we haven't specifically talked
about what they are just yet.
0:23
So let me teach you some of
the basics of objects first.
0:27
Then we'll dive into the math object and
start generating randomness.
0:29
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