1
nothing i do works, 2 days ive been trying #14precourse exercise 1 prototypes
Jayese (0)

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
this.UserClass = userclass;

UserClass.prototype.greeting = function(){

}

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

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

You should check resources online, like w3schools.com, before posting your question here. Anyways, here is the answer:

function exerciseOne(UserClass)  {
  UserClass.prototype.greeting = function {
    return 'Hello, it is nice to meet you!';
  }
  return UserClass
}

The this.UserClass = userclass line makes no sense because you do not have a variable called userclass, nor do you have a property called UserClass.

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