Generate Random Whole Numbers with JavaScript help

Generate Random Whole Numbers with JavaScript help
0

#1

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/


#2

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


#3

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


#4

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


#5

I solved it. Thanks everyone!