Create a Monkey
class in a new js file, main.js
, which has the following attributes:
name
- a string, which should be set by a method calledassignName
species
- a string, which should be determined by some inputfoodsEaten
- an array, which should be initialized as an empty array
And the following methods:
eat(food)
- adds a food (a string) to the list of foods eatenintroduce
- introduces self, with name, species, and what it's eatencountFoods
- that states how many items of food have been eaten- add a new property to the constructor called
bananasEaten
that has a default value of 0. Modify yourfoodsEaten
method so that every time a monkey eats a banana it adds to thebananasEaten
property.