Click here to navigate the course.

Drag the edges to resize the window.

In Projects, you can keep track of your progress as you go throught the tasks. Check each item as you complete it!

Code Editor

As it turns out, JavaScript has some tricks up its sleeve to make our lives easier.

JavaScript has built in functions, which help us do everyday things.

An important function is the ability to generate a random number and we can do that with this code: Math.random(). This code will return a random number between 0 and 1.

To generate a random number between 0 and 50, we could multiply this result by 50, like so: Math.random() * 50.

The problem with this is that the answer will most likely be a decimal. Luckily, JavaScript has our back with another built in function called Math.floor. If you write Math.floor(8.6), it will return 8. It rounds down to the nearest whole number.

Let's utilize these two methods to generate a random number between 0 and 100.

Report a Bug
If you see a bug or any other issue with this page, please report it here.