Tell us what’s happening:
when I run this I get
-
Failed:The result of
randomWholeNum
should be a whole number. -
Passed:You should use
Math.random
to generate a random number. -
Passed:You should have multiplied the result of
Math.random
by 10 to make it a number that is between zero and nine. -
Passed:You should use
Math.floor
to remove the decimal part of the number.
I have tried many things and I am still not passing this part, nor do I understand what I am missing. Finding java harder to understand than HTML. Any hints would be appreciated.
Your code so far
function randomWholeNum() {
// Only change code below this line
Math.floor(Math.random()*10);
return randomWholeNum;
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
Challenge: Basic JavaScript - Generate Random Whole Numbers with JavaScript
Link to the challenge: