More Ternaries

Your new assignments, should you choose to accept them. They're optional!

Remember to use ternaries and NOT if and else!

  • Write a function called oddOrEven that takes in a number and returns 'Odd!' if it's odd and 'Even!' if it's even.
  • Write a function called evenlyDivisible that takes in two numbers and returns 'Evenly divisible!' if the first one can be divided evenly by the second, and 'Not evenly divisible!' if it does not.
  • Write a function called checkPassword that takes in a password and checks if it matches 'gR3@tsecurity'. If it does, return 'Success!'. If it doesn't, return 'Failure!'.
  • Write a function called newPasswordsMatch that takes in two passwords and returns 'Success!' if they're identical, 'Failure!' if they are not.
  • Write a function called 'theBaseballPlayoffsHaveBegunAndItsAGoodThingBecauseColinIsReallyStartingToReachForTernaryExamplesButDoesKnowBaseball' that takes in a time in seconds since the ball was hit that the batter took to reach first and the time in seconds since the ball was hit that the ball took to reach the fielder's glove. If the batter's time is less or the same as the fielder's time (tie goes to the runner!), return 'Safe!'. Otherwise, return 'Out!'.
  • Write a function called electoralCollege that returns 'Blue!' if the number given is lower than 270 and 'Red!' if it is greater than or equal to 270.