Skip to content

Instantly share code, notes, and snippets.

@laurengoods
Created January 21, 2014 16:16
Show Gist options
  • Save laurengoods/8543068 to your computer and use it in GitHub Desktop.
Save laurengoods/8543068 to your computer and use it in GitHub Desktop.
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");
} };
console.log(creditCheck(75));
console.log(creditCheck(125));
console.log(creditCheck(100));
@jczaplew
Copy link

You could also do

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"); 
  }
};

creditCheck(75);

creditCheck(125);

creditCheck(100);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment