Whole Numbers Within a Range Test Fail

Tell us what’s happening:
Describe your issue in detail here.
Can someone please tell me why my solution does not pass? I must be doing something wrong, but I can’t see it…

  **Your code so far**

function randomRange(myMin, myMax) {
// Only change code below this line
var myMin = 12;
var myMax = 99;

return Math.floor(Math.random() * (myMax - myMin + 1) + myMin);

// Only change code above this line
}

console.log(randomRange());
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36

Challenge: Generate Random Whole Numbers within a Range

Link to the challenge:

Why are you redefining these two values? This means that your ‘function’ is no longer responding to the inputs and always gives a random number in only one range of values.

Ahh, I see. Thank you.

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