Tell us what’s happening:
// running tests
You should use Math.floor to remove the decimal part of the number.
// tests completed
Your code so far
var randomNumberBetween0and9 = (Math.random() * 10);
function randomWholeNum() {
// Only change code below this line.
return Math.floor(Math.random() * 10);
};
console.log(randomWholeNum());
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript