I have a problem with this challenge
My code
// Example
function ourRandomRange(ourMin, ourMax) {
return Math.floor(Math.random() * (ourMax - ourMin + 1)) + ourMin;
}
ourRandomRange(1, 9);
// Only change code below this line.
function randomRange(myMin, myMax) {
return Math.floor( Math.random() * (myMax - myMin + 1)) + myMin;
}
// Change these values to test your function
var myRandom = randomRange(5, 15);
What kind of a problem? It’s workin for me:
why do you need this part?:
myMin = Math.ceil(myMin);
myMax = Math.floor(myMax);
Just remove it and it should work.
I take out. It did not pass it.
Try to copy/paste this one and let me know.
// Example
function ourRandomRange(ourMin, ourMax) {
return Math.floor(Math.random() * (ourMax - ourMin + 1)) + ourMin;
}
ourRandomRange(1, 9);
// Only change code below this line.
function randomRange(myMin, myMax) {
return Math.floor( Math.random() * (myMax - myMin + 1)) + myMin; // Change this line
}
// Change these values to test your function
var myRandom = randomRange(5, 15);
I think there is a problem with freeCodeCamp verificator (parser or however it’s called).
I have similar issues with “Escaping Literal Quotes in Strings” task. It seems to be ok but site won’t accept it. Just go to next challenge.
var myRandom = randomRange(5, 15); wrong
I did this
randomRange(5, 15); It is work.
Thanks.
No worries, keep up the good work.