-
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. -
Define a function
maxOfThree
that takes three numbers as arguments and returns the largest of them.
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 printBonjour le monde
) - Call that function for each of the supported languages and log the result to make sure it works.
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.
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”.