Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const getUserConstructor = () => {
- // create a constructor called User
- // it should accept an options object with username, name, email, and password properties
- // in the constructor set the username, name, email, and password properties
- // the constructor should have a method 'sayHi' on its prototype that returns the string 'Hello, my name is {{name}}'
- // {{name}} should be the name set on each instance
- // return the constructor
- const User = (options) => {
- this.username = options.username;
- this.name = options.name;
- this.email = options.email;
- this.password = options.password;
- this.sayHi = () => {
- return `Hello, my name is ${this.name}`;
- };
- };
- return User;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement