Generate Random Whole Numbers with JavaScript 2019

Tell us what’s happening:
I’m confused on this problem: The result of randomWholeNum should be a whole number.

I don’t know what is missing but I understand that it means the number is rounded up or down to whole number

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.random(); 
}

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript

You should return that line of code instead of Math.random();

so how do I do that? I tried replacing Math.random(); with randomNumberBetween0and9 and it did not work. Which line are you talking about?

With this line of code here Math.floor(Math.random() * 10) you are generating a random whole number from 0 to 9, which is exactly what the challenge is asking you to do, now you just need to return that. In your code right now for some reason you are returning Math.random(); and that is not what you are supposed to return from your function.

For more info about the return keyword in function read the documentation here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return

Take a look at the description section, hopefully that will clarify things for you.