Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Random Number Challenge0:53 with Dave McFarland
Test your new skills in functional program by creating a random number generating function.
Time for a quick challenge.
I want you to take a random number generating function we created in
the last video and make it even more flexible.
This time, the function needs to accept two values, a lower and an upper value.
In other words, you want the function to be able to produce random values between
say, 10 and 100 or 9 and 78, as well as between 1 and 6 or even 0 and 6.
You can open the workspace on this page to try out the challenge.
Open the random.js file.
It has the basic formula for creating a random value between two numbers.
Use this as the basis for creating your function.
Once the function is done, make sure you call it by passing different values.
You can either display the values using the alert, document.write or
In the next video I'll show you how I programmed this.
You need to sign up for Treehouse in order to download course files.Sign up