I am unable to find the error in this code

Tell us what’s happening:
Hi, my code isn’t passing the following test:
The lowest random number that can be generated by randomRange should be equal to your minimum number, myMin .

The highest random number that can be generated by randomRange should be equal to your maximum number, myMax .

  **Your code so far**

function randomRange(myMin, myMax) {
// Only change code below this line
myMin = 1;
myMax = 10;

return Math.floor(Math.random() * (myMax - myMin + 1)) + myMin;
// Only change code above this line
}
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36

Challenge: Generate Random Whole Numbers within a Range

Link to the challenge:

If you set the values of your function’s arguments in the function, then whatever calls the function can’t change the values of those variables.

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.