This is program that collects a number from a user, then prints out a random number from 1 to the number the user selects

prompt() dialogue to collect user input

parseInt() function to convert the input to an integer

Math.random() method to create a random number

Back to other Code Examples.