Guys I am stuck I need help

** The result of randomWholeNum should be a whole number**

  **Your code so far**

function randomWholeNum() {

// Only change code below this line
var randomNumberBetween0and19 = Math.floor(Math.random() * 20);

function randomWholeNum() {


return Math.floor(Math.random() * 10);
}
}
console.log(randomWholeNum())
  **Your browser information:**

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

Challenge: Generate Random Whole Numbers with JavaScript

Link to the challenge:

Hey there,

You have a function definition within your function definition of the same name. That is likely causing issues.

oky let me look at it

Your outside function doesn’t have a return value - hence it returns nothing and “nothing” is not a whole number.
You can just delete the var, the function within, adjust brackets and that’s the solution.

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