Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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}`);
- }
- }
- const user = new User("john", "john@gmail.com");
- user.login("2020-12-01");
- const admin = new Admin("jane", "jane@gmail.com", "site-admin");
- admin.login("2020-12-01");
- admin.givePrivilige("deleteUsers");
- console.log(admin);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement