Advertisement
Guest User

Untitled

a guest
Jul 10th, 2017
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. const getUserConstructor = () => {
  2. // create a constructor called User
  3. // it should accept an options object with username, name, email, and password properties
  4. // in the constructor set the username, name, email, and password properties
  5. // the constructor should have a method 'sayHi' on its prototype that returns the string 'Hello, my name is {{name}}'
  6. // {{name}} should be the name set on each instance
  7. // return the constructor
  8.  
  9. const User = (options) => {
  10. this.username = options.username;
  11. this.name = options.name;
  12. this.email = options.email;
  13. this.password = options.password;
  14. this.sayHi = () => {
  15. return `Hello, my name is ${this.name}`;
  16. };
  17. };
  18. return User;
  19. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement