-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay42ClassInheritance.html
43 lines (37 loc) · 1.03 KB
/
Day42ClassInheritance.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Day 42</title>
</head>
<body>
<script>
class User{
constructor(firstname,lastname,email){
this.firstname=firstname;
this.lastname=lastname;
this.email=email;
}
userdetails(){
return `${this.firstname} and mail id ${this.email}`;
}
username(){
return this.firstname;
}
}
const user1=new User();
class Admin extends User{
constructor(firtname,lastname,email,mobile){
super(firtname,lastname,email);
this.mobile=mobile;
}
getmobile(){
return `${this.mobile}`;
}
}
const ad1=new Admin('ponmani','venkatesan','[email protected]','933333');
console.log(ad1);
</script>
</body>
</html>