Skip to content

Instantly share code, notes, and snippets.

@McLarenCollege
Last active January 7, 2022 10:07
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 McLarenCollege/2cb4072989fc5e4524b5efca63ccb2d3 to your computer and use it in GitHub Desktop.
Save McLarenCollege/2cb4072989fc5e4524b5efca63ccb2d3 to your computer and use it in GitHub Desktop.
Choose appropriate drink

Create a functon that accepts the person's age as an argument and prints the appropriate statement to the console.

  • Kids - under 14 years
  • Teens - under 18 years
  • Young Adults - under 21 years
  • Adults - 21 years or more

Statements to be printed:

  • "Kids drink Milk."
  • "Teens drink Coke"
  • "Young adults drink Tea"
  • "Adults drink Coffee"

CODE TEMPLATE


function chooseDrink(age){
// write your code here
}
console.log(chooseDrink(12));// "Kids drink Milk"
console.log(chooseDrink(17));// "Teens drink Coke"
console.log(chooseDrink(20));// "Young adults drink Tea"
console.log(chooseDrink(30));// "Adults drink Coffee"
console.log(chooseDrink(14));// "Teens drink Coke"
console.log(chooseDrink(18));// "Young adults drink Tea"
console.log(chooseDrink(21));// "Adults drink Coffee"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment