Getting older - ;TLDR
Sadly, there comes a time when your new pet has to grow up.
Your challenge in this step is to test-drive the growUp
feature of the Pet
function.
This can be broken down into two steps:
-
The
Pet
should have an initial age of0
-
The
growUp
method should increase theage
property by1
Learning objectives
-
define a method as a function belonging to an object
-
understand what is meant by an objects prototype
-
understand why we add methods to the prototype
-
understand why we don't usually add properties to the prototype
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
-
implement the code to make the tests pass
Once you are done, commit your work and push to GitHub