Animal = {
var Animal = function(name, species, sex) {
this.species = species
this.sex = sex
this.name = name
this.stomach = []
}
Animal.prototype.eat = function(food) {
this.stomach.push(food)
}
Animal.prototype.poop = function() {
var randomAmount = Math.round(Math.random() * (this.stomach.length - 1))
var doggyBag = []
for( let i = 0; i < randomAmount; i++ ) {
doggyBag.push( this.stomach.pop() )
}
return doggyBag;
}
Animal.prototype.introduce = function() {
return "Hi, my name is " + this.name + ". I'm a " + this.sex + " " + this.species + "."
}
return Animal
}