Command Shift

Death - ;TLDR

We can now feed and walk our pets, but how do we know when we need to?

Your challenge in this step is to give the Pet function an isAlive property that really lets you know how the pet is feeling.

  • if the pet's fitness is 0 or less, it should return false.

  • if the pet's hunger is 10 or more, it should return false.

  • if the pet's age is 30 or more, it should return false.

  • otherwise it should return true.

Learning objectives

  • Using getter methods to compute property values

To complete this challenge, you will need to:

  • test the expected behaviour in the Node CLI

  • write unit tests to to cover the expected behaviour

  • add a getter function to Pet's prototype

Once you are done, commit your work, push to GitHub. :twisted_rightwards_arrows:

On this page