IM getting error msg on my answerr? (jave script)
faziz6006 (2)

Exercise Two: In this exercise you are given a class called AnimalClass.
// The class will already have the properties 'name', 'noise' on it.
// You will be adding a method to the prototype called 'speak'
// Using the 'this' keyword, speak should return the following string:
// '<name> says <noise>'
// DO NOT create a new class or object

my code :

AnimalClass.prototype.speak = function(says){
this.speak = 'says';
return + ' ' + this.speak + '' + this.noise;

error msg i keep getting :
Should add a method to the prototype called speak

You are viewing a single comment. View All
vedprad1 (722)

You can't say this.speak = says because you are in the middle of defining this.speak.
I don't think you need says as a parameter, too. Try this:

AnimalClass.prototype.speak = function() {
  return + ' says ' + this.noise;

If this answer is correct, please check the checkmark on the left side of this message. Thanks and Good Luck!