Generate Random Whole Numbers with JavaScript help

Generate Random Whole Numbers with JavaScript help


Tell us what’s happening:
Here is my code. It passes all tests but isn’t returning a whole number. Thoughts?

Your code so far

var randomNumberBetween0and19 = Math.floor(Math.random() * 20);

function randomWholeNum() {

  // Only change code below this line.
Math.floor(Math.random() * 10);
  return Math.floor();

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.1 Safari/605.1.15.

Link to the challenge:


Store the Math method in a variable and return that variable.


you are returning return Math.floor(); instead of the whole number that you calculated. In essence you are returning NaN, because Math.floor() requires a parameter


You should’ve return the first statement you wrote in the function.


I solved it. Thanks everyone!