Advertisement
Guest User

Object-methods

a guest
Dec 7th, 2019
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function User(name, email, password) {
  3.     this.name = name,
  4.     this.email = email,
  5.     this.password = password,
  6.  
  7.     this.details = function() {
  8.         console.log(`${this.name}, ${this.email}, ${this.password}`);
  9.     }
  10. }
  11.  
  12. const user1 = new User('John', 'john@doe.com', '1234');
  13. user1.details();
  14.  
  15. const user2 = new User('Mary', 'mary@jane.com', '1234');
  16. user2.details();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement