Created
February 17, 2012 02:50
-
-
Save ashryanbeats/1850112 to your computer and use it in GitHub Desktop.
Conditionals in Javascript Project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var die1 = Math.floor(Math.random()*6 + 1); | |
var die2 = Math.floor(Math.random()*6 + 1); | |
var score; | |
if(die1 === 1 || die2 === 1){ | |
score = 0 | |
} else { | |
if(die1 === die2){ | |
score = die1+die2*2 | |
} else { | |
score = die1+die2 | |
} | |
} | |
console.log("You rolled a "+die1+" and a "+die2+" for a score of "+score); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment