Advertisement
Guest User

Untitled

a guest
Apr 10th, 2016
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function User(username, password) {
  2.     Object.defineProperties(this, {
  3.         id: {
  4.             get: function() {
  5.                 return 1;
  6.             },
  7.             enumerable: true
  8.         },
  9.         username: {
  10.             get: function() {
  11.                 return username;
  12.             },
  13.             enumerable: true
  14.         },
  15.         password: {
  16.             get: function() {
  17.                 return password;
  18.             }
  19.         }
  20.     });
  21. }
  22.  
  23. var pippo = new User('pippo', 123456);
  24. var pluto = new User('pluto', 'ciao!11');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement