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
vedprad1 (694)

Exercise One:

  1. You have an extra curly brace for the prototype function.
  2. You are missing a semicolon after the return statement.

Exercise Two:

  1. You need to close the prototype with a curly brace and a semicolon: };.

If this answers your question, please check the checkmark on the left side of this message. Thanks and Good Luck!