Javascript Problem:
Design a Pet object. A Pet is created with a language argumentstring and a stomach represented by an array. The Pet shouldsupport functions: eat() and speak(). Use the prototype property todefine your object’s interface.
eat(food) will store the passed argument into its stomach andreturn what it has eaten thus far.
speak(sentence) will simply return the passed in phrase.
function Pet(language) {
// create stomach
// set language
}
// takes a food_item STRING and returns everything eaten so farARRAY
Pet.prototype.eat(food_item){
// … complete
}
// takes in a sentence STRING and returns the passed in sentenceSTRING with no change
Pet.prototype.speak(sentence){
// … complete
}
Create an object, Dog, that implements the Pet interface andtakes