oop

01. Cats and Dogs πŸ‘©β€πŸŽ“πŸ‘¨β€πŸŽ“

In this activity, you will make a cats object and a dogs object, each with three keys.

Instructions

  • Make a dogs object with three keys:

    • First key called raining with a value of true.

    • Second key called noise with a value of “Woof!”

    • Third key called “akeNoise” which contains a function that console.logs the noise to the screen if it is raining dogs.

  • Next, make a cats object with three keys:

    • First key called raining with a value of false.

    • Second key called noise with a value of “Meow!”

    • Third key called makeNoise which contains a function that console.logs the noise to the screen if it is raining cats.

  • Make the dog bark.

  • Make the cat meow.

πŸ†BONUS

  • Create a function called massHysteria that takes in both the cats and the dogs objects and prints “DOGS AND CATS LIVING TOGETHER! MASS HYSTERIA!” if both of the raining keys are equal to true.

  • See if there is any way to further optimize your code.


βœ… Solutions

Solutions Click Here