dice roll
by jasonvee
JavaScript
// create random from 1 - 6
var randNum1 = Math.floor(Math.random()*6 + 1);
var randNum2 = Math.floor(Math.random()*6 + 1);
//create a variable called dice_one that stores a random number (1-6)
var diceOne = randNum1;
//create a variable called dice_two that stores a random number (1-6)
var diceTwo = randNum2;
//output result of dice 1, dice 2 and add then together
document.write('dice 1: '+ diceOne + '<br>');
document.write('dice 2: '+ diceTwo + '<br>');
document.write('total: ' , diceOne + diceTwo)