Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Done #2017

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Done #2017

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 34 additions & 4 deletions flow-control.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,49 @@
function basicTeenager(age) {

if(age >= 13 && age <=19){
return "You are a teenager!"
}
}

function teenager(age) {
if(age >= 13 && age <=19){
return "You are a teenager!"
}
return "You are not a teenager"

}

function ageChecker(age) {

if(age >= 13 && age <=19){
return "You are a teenager!"
}
else if(age <= 12){
return "You are a kid"
}
return "You are a grownup"
}

function ternaryTeenager(age) {

return (age >= 13 && age <=19) ? "You are a teenager":"You are not a teenager"
}

function switchAge(age) {

function switchAge(age) {
switch(age){
case 13:
return "You are a teenager"
case 14:
return "You are a teenager"
case 15:
return "You are a teenager"
case 16:
return "You are a teenager"
case 17:
return "You are a teenager"
case 18:
return "You are a teenager"
case 19:
return "You are a teenager"
default:
return "You have an age"
}
}