Created
August 31, 2018 19:39
-
-
Save jordanhudgens/35e04f857734e8bd3e5cffeb6ba1f18a to your computer and use it in GitHub Desktop.
This file contains 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
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