Every which way!!
DeShawnKeller (0)

I have tired these every which way. I think I'm putting my UserClass in wrong but the other ways I have had this worked out caused for me to put a semicolon behind my return. So confused and frustrated. Please someone explain what step and/or steps I am missing.
function exerciseOne(UserClass){
// Exercise One: In this exercise you are given a class called UserClass.
// You will be adding a method to the prototype called greeting
// This method will return the string: 'Hello, it is nice to meet you!'
// DO NOT create a new class or object
UserClass.prototype.greeting = function() {
this.greeting = 'Hello, it is nice to meet you!';
};
}
// Please write your code in the lines above
return UserClass
}

function exerciseTwo(AnimalClass){
// 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
AnimalClass.prototype.speak = function () {
return this.name + ' says ' + this.noise;

// Please write your code in the lines above
return AnimalClass
}

You are viewing a single comment. View All
Answered by vedprad1 (733) [earned 5 cycles]
View Answer
a5rocks (519)

You forgot an ending curly brace for your AnimalClass.prototype.speak function. (and have an extra one at the end of your UserClass.prototype.greeting function)