Quotes help make search much faster. Example: "Practice Makes Perfect"

Saturday, December 8, 2012

Codecademy: Codeyear On Nine Conditions (Part 1)


//sample solution


var player = prompt("Pick rock, paper, or scissors.");

var choices = ["rock","paper","scissors"];
var computer = choices[Math.floor(Math.random()*3)];

var whatThen;
// Write the first level of your conditional here.
if(player==="rock"){
whatThen="rocked";
} else if(player==="paper"){
whatThen="papered";
} else if(player==="scissors"){
whatThen="scissored";
} else {
whatThen="invalid user input";
}

console.log(whatThen);
/*
console.log("You picked "+player+".");
console.log("The computer picked "+computer+".");
*/

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts