Skip to content

Instantly share code, notes, and snippets.

@elisavetTriant
Last active November 2, 2022 05:32
Show Gist options
  • Save elisavetTriant/0a9c51f00199927a39c7f67979c44782 to your computer and use it in GitHub Desktop.
Save elisavetTriant/0a9c51f00199927a39c7f67979c44782 to your computer and use it in GitHub Desktop.
FreeCodeCamp min-max
/* 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