lemansky

Untitled

Apr 6th, 2021
746
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class User {
  2.     constructor(name, email) {
  3.         this.name = name;
  4.         this.email = email;
  5.     }
  6.  
  7.     login(date){
  8.         this.date = date;
  9.         console.log(`${this.email} logged on ${this.date}`);
  10.     }
  11. }
  12.  
  13. class Admin extends User {
  14.     constructor(name, email, rank){
  15.         super(name, email);
  16.         this.rank = rank;
  17.     }
  18.     givePrivilige(privilage){
  19.         console.log(`${this.email} has privilige ${privilage}`);
  20.     }
  21.    
  22. }
  23.  
  24. const user = new User("john", "john@gmail.com");
  25. user.login("2020-12-01");
  26.  
  27. const admin = new Admin("jane", "jane@gmail.com", "site-admin");
  28. admin.login("2020-12-01");
  29. admin.givePrivilige("deleteUsers");
  30. console.log(admin);
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×