Using the below script exercise.js
, finish the methods getAge()
, addJoke()
and getRandomJoke()
and make the code run properly.
- Implement the method
addJoke
. The method shuould take one string argument and add it to the array of jokes.
- Implement the
getRandomJoke
method using theMath.random
. The method should return one random joke from the array of jokes.
- Implement the method
getAge
, which shuould return age in years calculated using the propertybirthDate
. To do this you will have to get the current time and Chuck'sbirthDate
.
- Once done, the code on the bottom should run properly and you should be able to add jokes and get random jokes.