JavaScript Math.floor and Math.random

Tell us what’s happening:

How do I do this

Your code so far

function randomRange(myMin, myMax) {
// Only change code below this line
`return Math.floor(Math.random() * (10 - 1 + 1)) +1;`

// Only change code above this line

Your browser information:

User Agent is: Mozilla/5.0 (iPhone; CPU iPhone OS 13_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Mobile/15E148 Safari/604.1.

Challenge: Generate Random Whole Numbers within a Range

Link to the challenge:

  1. Your function has quotes around the only operation it is doing, which change that to a string, which make it not work.

  2. Your function needs to take the variables (arguments) from the beginning. I.e., if you want to process with 1 as myMin and 10 as myMax, you would pass those to the function like:


You don’t hard-code values of variables (arguments) in the function. You need to use myMin and myMax within the function.