Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
It's time for another programming challenge! In this challenge, you'll create a random number generator. It should collect a number from a user, then print a random number from 1 up to the user's provided number.
Challenge Instructions
- Collect a user's input.
- Convert that input from a string to a number. This will be the highest possible random number in the range of numbers starting from 1.
- Use the
Math.random()
method to create a random number using the number provided by the user. - Create a message displaying the random number. You can use any method you want to display the message. For instance, print it to the console, display it on the page, or with an alert.
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