scrimba
Yet Another Programming Course
111 - Repetition: While
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

111 - Repetition: While
AboutCommentsNotes
111 - Repetition: While
Expand for more info
index.js
run
preview
console
// Javascript
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* Generate a random number from 1-50.
* Print the number to the console.
* Repeat until the number selected is greater than 45
* (modify so we get a minimum of 10 printed values)
* * * * * * * * * * * * * * * * * * * * * * * * * * */
function printRand() {

}

printRand();



// Generating random numbers is available in most programming languages.
// The Javascript method: Math.random()

// Return a random integer from min to max, inclusively
function randomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}

Console
/index.html
-8:03