From 8d0f83aaa0d9bbd51e63dda7caa8ffdf6ebc902f Mon Sep 17 00:00:00 2001 From: Susana Martins Date: Sat, 10 Apr 2021 11:30:23 -0700 Subject: [PATCH 1/3] added question to repository by @5usana --- .../questions/old-enough-to-drink/index.md | 47 +++++++++++++++++++ scripts/new-question/index.md | 3 +- 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 content/questions/old-enough-to-drink/index.md diff --git a/content/questions/old-enough-to-drink/index.md b/content/questions/old-enough-to-drink/index.md new file mode 100644 index 00000000..272e43e0 --- /dev/null +++ b/content/questions/old-enough-to-drink/index.md @@ -0,0 +1,47 @@ +--- +title: Old Enough to Drink +tags: + - conditional +order: 76 +date: '2021-04-10' + - 'if (age < 21) { + return "Sorry, you're too young."; + } else { + return "Hey, you may enter the bar."; + } + }' + - 'if (age > 21) { + return "Hey, you may enter the bar"; + } else { + return "Sorry, you're too young."; + } +} // correct' + - 'if (age < 21) { + return "Hey, you may enter the bar"; + } else { + return "Sorry, you're too young."; + } +}' +--- + + Friday Night Drinks! Create a variable that holds a person's age. If their age is greater than 21, return "Hey, you may enter the bar"; otherwise return "Sorry, you're too young." + + +```javascript +const age = 21; +function oldEnough() { + + if (age > 21) { + return "Hey, you may enter the bar"; + } else { + return "Sorry, you're too young."; + } +} +console.log(oldEnough()); +``` + + + +Here's a simple conditional to set a variable that will determine whether or not a person is old enough to have an adult beverage! + + diff --git a/scripts/new-question/index.md b/scripts/new-question/index.md index 5292450c..f066ed87 100644 --- a/scripts/new-question/index.md +++ b/scripts/new-question/index.md @@ -10,5 +10,4 @@ answers: - - + \ No newline at end of file From 3a4cafaaf51f77e1886492c419cd2b601ec9f6c3 Mon Sep 17 00:00:00 2001 From: Susana Martins Date: Sat, 10 Apr 2021 12:35:53 -0700 Subject: [PATCH 2/3] added question to repository by @5usana, updated --- .../questions/old-enough-to-drink/index.md | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/content/questions/old-enough-to-drink/index.md b/content/questions/old-enough-to-drink/index.md index 272e43e0..ceb0e2f5 100644 --- a/content/questions/old-enough-to-drink/index.md +++ b/content/questions/old-enough-to-drink/index.md @@ -4,31 +4,33 @@ tags: - conditional order: 76 date: '2021-04-10' - - 'if (age < 21) { - return "Sorry, you're too young."; +answers: + - 'Option a: `if (age < 21) { + return "Sorry, you\'re too young."; } else { return "Hey, you may enter the bar."; - } - }' - - 'if (age > 21) { + }`' + + - 'Option b: `if (age > 21) { return "Hey, you may enter the bar"; } else { - return "Sorry, you're too young."; - } -} // correct' - - 'if (age < 21) { + return "Sorry, you\'re too young."; + }` // correct' + + - 'Option c: `if (age < 21) { return "Hey, you may enter the bar"; } else { - return "Sorry, you're too young."; - } -}' + return "Sorry, you\'re too young."; + }`' --- Friday Night Drinks! Create a variable that holds a person's age. If their age is greater than 21, return "Hey, you may enter the bar"; otherwise return "Sorry, you're too young." ```javascript + const age = 21; + function oldEnough() { if (age > 21) { @@ -36,7 +38,8 @@ function oldEnough() { } else { return "Sorry, you're too young."; } -} +}; + console.log(oldEnough()); ``` From a587b2c6e83d85bb39961109ab89ed8eea312e55 Mon Sep 17 00:00:00 2001 From: Susana Martins Date: Sun, 11 Apr 2021 19:15:02 -0700 Subject: [PATCH 3/3] updated syntext for retest --- content/questions/old-enough-to-drink/index.md | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/content/questions/old-enough-to-drink/index.md b/content/questions/old-enough-to-drink/index.md index ceb0e2f5..6424a707 100644 --- a/content/questions/old-enough-to-drink/index.md +++ b/content/questions/old-enough-to-drink/index.md @@ -5,23 +5,11 @@ tags: order: 76 date: '2021-04-10' answers: - - 'Option a: `if (age < 21) { - return "Sorry, you\'re too young."; - } else { - return "Hey, you may enter the bar."; - }`' + - 'Sorry, you\'re too young.' - - 'Option b: `if (age > 21) { - return "Hey, you may enter the bar"; - } else { - return "Sorry, you\'re too young."; - }` // correct' + - 'Hey, you may enter the bar // correct' - - 'Option c: `if (age < 21) { - return "Hey, you may enter the bar"; - } else { - return "Sorry, you\'re too young."; - }`' + - 'error' --- Friday Night Drinks! Create a variable that holds a person's age. If their age is greater than 21, return "Hey, you may enter the bar"; otherwise return "Sorry, you're too young."