Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
The Random Challenge0:43 with Dave McFarland
In this video, Dave challenges you to use Workspaces to build a random number generator and print the results to the browser window.
Launch Workspaces to try The Random Challenge
Ready for a challenge? Using Workspaces, create a Random Number Generator!
See if you can build a program that collects a number from a user, then prints out a random number from 1 to the number the user selects. Now is the opportunity to practice using some of the commands you learned in this course.
Don't forget some commands you've learned so far!
prompt()dialogue to collect user input
parseInt()function to convert the input to an integer
Math.random()method to create a random number
Dave will go over how to do it in the next video, but if you're up for the challenge, open up a new Workspace now and try it out!
Ready for a programming challenge?
You also learned how to create random numbers.
For this challenge, create a random number generator.
Collect a number from a user and
print a random number from 1 to the user's provided number.
To do this, you'll need to use some of the things you've learned in this course,
such as the prompt dialogue to collect user input.
The parselnt function to convert the input to an integer, and
the Math.random method to create a random number.
To go even further, create a program that accepts two values and
generates a random number from the first to the second.
You need to sign up for Treehouse in order to download course files.Sign up