Last active
November 2, 2022 05:32
-
-
Save elisavetTriant/0a9c51f00199927a39c7f67979c44782 to your computer and use it in GitHub Desktop.
FreeCodeCamp min-max
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Create a function called randomRange that takes a range myMin and myMax and returns | |
a random number that's greater than or equal to myMin, and is less than or equal to myMax, inclusive. */ | |
// 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); | |
console.log(myRandom); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment