Skip to content

MohammedAlghamdi3/hw-w01d03-functions-and-conditionals

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Homework - Week 1, Day 3: Functions and Conditionals!

Biggest Numbers

  1. Define a function maxOfTwoNumbers that takes two numbers as arguments and returns the largest of them. Use the if-then-else construct available in Javascript.

  2. Define a function maxOfThree that takes three numbers as arguments and returns the largest of them.

The World Translator

Write a function named helloWorld that:

  • takes 1 argument, a language code (for example "english", "arabic", "french")
  • returns "Hello, World" for the given language, for atleast 3 languages. (i.e. if the language is English, print "Hello World", if the language is Arabic write something "مرحبا بالعالم", if the language is French print Bonjour le monde)
  • Call that function for each of the supported languages and log the result to make sure it works.

The Grade Assigner

Write a function named assignGrade that:

  • takes 1 argument, a number score.
  • returns a grade for the score, either "A", "B", "C", "D", or "F"., where anything over 90 gets an A, anything over 80 gets a B, anything over 70 gets a C, anything over 60 gets a D, and anything lower than 60 gets an F.
  • Call that function for a few different scores and log the result to make sure it works.

The Pluralizer

Write a function named pluralize that:

  • takes 2 arguments, a noun and a number.
  • returns the number and pluralized form, like "5 cats" or "1 dog".
  • Call that function for a few different scores and log the result to make sure it works.

for example:

pluralize('giraffe', 5);  // returns "5 giraffes"
pluralize('door', 1); // returns "1 door"
  • Bonus: Make it handle a few collective nouns like "sheep" and "geese”.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%