First page Back Continue Last page Image
- Random With A Purpose Part 3
- var newNum = Math.floor(Math.random() * 6) + 1;
- What if we just add 1 to the result?
- window.onload = initAll;
- function initAll() {
- do{
- var ans = prompt("Want to roll again (y or n)","");
- var newNumber = Math.random() * 6;
- alert("You rolled a " + newNumber );
- }
- while(ans == "y");
- }