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:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript/

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!

How did you get this right i can get … “The result of randomWholeNum should be a whole number.”

my code looks like this:

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

function randomWholeNum() {

// Only change code below this line.

return Math.random() * 10 == Math.floor();
}