Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Document</title>
- </head>
- <body>
- <script>
- document.addEventListener("DOMContentLoaded", function(event){
- class User {
- constructor(name, email) {
- this.name = name;
- this.email = email;
- }
- login(date){
- this.date = date;
- console.log(`${this.email} logged on ${this.date}`);
- }
- }
- class Admin extends User {
- constructor(name, email, rank){
- super(name, email);
- this.rank = rank;
- }
- givePrivilige(privilage){
- console.log(`${this.email} has privilige ${privilage}. Rank increased to: ${++this.rank}`);
- }
- }
- // const user = new User("john", "[email protected]");
- // user.login("2021-12-01");
- // const admin = new Admin("jane", "[email protected]", 1);
- // admin.login("2021-12-01");
- // admin.givePrivilige("deleteUsers");
- // console.log(admin);
- // console.log(admin.rank)
- });
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment