lemansky

Untitled

Nov 19th, 2020 (edited)
978
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.21 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>Document</title>
  6. </head>
  7. <body>
  8.     <script>
  9.         document.addEventListener("DOMContentLoaded", function(event){
  10.             class User {
  11.                 constructor(name, email) {
  12.                     this.name = name;
  13.                     this.email = email;
  14.                 }
  15.  
  16.                 login(date){
  17.                     this.date = date;
  18.                     console.log(`${this.email} logged on ${this.date}`);
  19.                 }
  20.             }
  21.  
  22.             class Admin extends User {
  23.                 constructor(name, email, rank){
  24.                     super(name, email);
  25.                     this.rank = rank;
  26.                 }
  27.                 givePrivilige(privilage){
  28.                     console.log(`${this.email} has privilige ${privilage}. Rank increased to: ${++this.rank}`);
  29.                 }
  30.             }
  31.  
  32.             // const user = new User("john", "john@gmail.com");
  33.             // user.login("2021-12-01");
  34.  
  35.             // const admin = new Admin("jane", "jane@gmail.com", 1);
  36.             // admin.login("2021-12-01");
  37.             // admin.givePrivilige("deleteUsers");
  38.             // console.log(admin);
  39.             // console.log(admin.rank)
  40.         });
  41.     </script>
  42. </body>
  43. </html>
Add Comment
Please, Sign In to add comment