Javascript Create an object, Gremlin, that extends the Monster interface and takes the same argument language.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 19RQ
icon
Related questions
Question

Javascript

Create an object, Gremlin, that extends the Monster interface and takes the same argument language.

  • Gremlins inherits how a monster eats.
  • Gremlins speaks differently. Gremlins replace each word in a sentence with its only known language, "gar". For example, if the sentence is "I like chicken", the speak() method will turn it into "gar gar gar".
class Monster {
constructor(language){
this.language = language;
this.stomach = Array();
}
// takes a food_item STRING and returns everything eaten so far ARRAY
eat(food_item) {
this.stomach.push(food_item);
}
 
// takes in a sentence STRING and returns the passed in sentence STRING with no change
speak(sentence) {
returnsentence;
}
 
}
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,