From 0ee1de0722d88ba81bcb26a6d34dbd1fd1e1c2b6 Mon Sep 17 00:00:00 2001 From: Kyle Horsch Date: Sun, 23 Apr 2017 14:03:51 +0000 Subject: [PATCH] Done. --- flow-control.js | 49 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/flow-control.js b/flow-control.js index 1e28c3aa..5ee88218 100755 --- a/flow-control.js +++ b/flow-control.js @@ -1,19 +1,50 @@ -function basicTeenager(age) { - +function basicTeenager(age) {if(age >=13 && age <=19) + return ("You are a teenager!") } -function teenager(age) { - +function teenager(age) {if(age >=13 && age <=19) + return ("You are a teenager!") +else +return("You are not a teenager") } -function ageChecker(age) { - -} +function ageChecker(age) {if(age >=13 && age <=19) + return ("You are a teenager!") + else if(age <=12) + return ("You are a kid") + else + return("You are a grownup") + } -function ternaryTeenager(age) { +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"); + break; + case (14): + return ("You are a teenager"); + break; + case (15): + return ("You are a teenager"); + break; + case (16): + return ("You are a teenager"); + break; + case (17): + return ("You are a teenager"); + break; + case (18): + return ("You are a teenager"); + break; + case (19): + return ("You are a teenager"); + break; + default: + return ("You have an age")} }