Skip to content

Instantly share code, notes, and snippets.

@laurengoods
laurengoods / creditcheck.js
Created January 21, 2014 16:16
Codeacademy javascript tutorial: functions and if else statements
// Write your function below.
// Don't forget to call your function!
var creditCheck = function(income)
{ if (income >= 100) {
return("You earn a lot of money! You qualify for a credit card");
} else {
return("Alas you do not qualify for a credit card. Capitalism is cruel like that");
} };
@laurengoods
laurengoods / rockpaperscissors.js
Created January 21, 2014 18:49
Rock, Paper, Scissors game
var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
computerChoice = "rock";
} else if(computerChoice <= 0.67) {
computerChoice = "paper";
} else {
computerChoice = "scissors";
}