Skip to content

Instantly share code, notes, and snippets.

@jordanhudgens
Created August 31, 2018 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordanhudgens/35e04f857734e8bd3e5cffeb6ba1f18a to your computer and use it in GitHub Desktop.
Save jordanhudgens/35e04f857734e8bd3e5cffeb6ba1f18a to your computer and use it in GitHub Desktop.
function ageVerification(age) {
// if (age > 25) {
// console.log('can rent a car');
// } else {
// console.log("can't rent a car");
// }
return age > 25 ? "can rent a car" : "can't rent a car";
}
ageVerification(30); //?
ageVerification(10); //?
function adminControls(user) {
// if (user) {
// if (user.admin) {
// return 'showing admin controls...';
// } else {
// return 'You need to be an admin';
// }
// } else {
// return 'You need to be logged in';
// }
return user
? user.admin ? "showing admin controls" : "You need to be an admin"
: "you need to be logged in";
}
const userOne = {
name: "Kristine",
admin: true
};
adminControls(userOne); //?
const userTwo = null;
adminControls(userTwo); //?
const userThree = {
name: "Tiffany",
admin: false
};
adminControls(userThree); //?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment