Conditionals Practice

If statements and Boolean logic are used in every useful program to help decide what should be done given a certain set of inputs or conditions. This exercise will help you become more familiar with these programming constructs.

  • Write a JavaScript function that accepts two numbers as inputs.
    Print out the lower number of the two.

  • Write a function to solve the following problem:

    • We have two monkeys, a and b, and the parameters aSmile and bSmile indicate if each is smiling. We are in trouble if they are both smiling or if neither of them is smiling. Return true if we are in trouble.
monkeyTrouble(true, true) → true
monkeyTrouble(false, false) → true
monkeyTrouble(true, false) → false
  • Give an appropriate greeting for the current time of day ("Good morning!", "Good afternoon!", or "Good evening!"). (Use the Javascript Date object)