JSFiddle - React, Tailwind, and code Playground
by akang2
JavaScript
// Act 3.5 write a "for" loop! :D
//Use a 'for' loop to roll the dice 15 times
//The block of the 'for' loop should call the function we wrote in Act 3.4
/*
for(init; condition; iterator) {
// your code that you want to loop
}
*/
function theRoll() {
var rolling = Math.floor(Math.random() * 6 + 1);
return rolling;
}
for (i = 0; i <= 15; i++) {
console.log(theRoll());
}