Skip to content

Instantly share code, notes, and snippets.

@prof3ssorSt3v3
Created July 31, 2017 01:01
Show Gist options
  • Save prof3ssorSt3v3/01c9e7e0edca93bfde5681df6cd3891a to your computer and use it in GitHub Desktop.
Save prof3ssorSt3v3/01c9e7e0edca93bfde5681df6cd3891a to your computer and use it in GitHub Desktop.
// While loops
//
// while(condition){
// statements
// }
//
// do{
// statements
// }while(condition)
let total = 30;
while( total < 30){
total += Math.floor(Math.random() * 5) + 1;
console.log('while', total);
}
do{
total += Math.floor(Math.random() * 5) + 1;
console.log('do', total);
}while( total < 30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment