Basic JavaScript - Generate Random Whole Numbers within a Range

Tell us what’s happening:
How is the solution to this challenge returning an error? I don’t get what I’m doing wrong and I’m having trouble understanding this concept.

Your code so far

function randomRange(myMin, myMax) {
  // Only change code below this line
 function randomRange(myMin, myMax) {
  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/106.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Generate Random Whole Numbers within a Range

Link to the challenge:

It looks like you copied a solution into your code incorrectly. You have a function inside of a function without being called.

Omg how embarrassing. :sweat_smile: Thanks!

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