-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay44Constructor.html
52 lines (47 loc) · 1.64 KB
/
Day44Constructor.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
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Day 44</title>
</head>
<body>
<script>
class Softwaredeveloper{
constructor(name,company,role){
this.name=name;
this.company=company;
this.role=role;
}
getdeveloper(){
return `${this.name} name ${this.company} company ${this.role}`
}
}
class Frontenddeveloper extends Softwaredeveloper{
//automatically construtor and super created internally parent is called
}
let fdeveloper=new Frontenddeveloper('ponmani','solverminds','frontend');
console.log(fdeveloper);
console.log(fdeveloper.getdeveloper());
class Softwaredeveloper1{
constructor(name,company,role){
this.name=name;
this.company=company;
this.role=role;
}
getdeveloper(){
return `${this.name} name ${this.company} company ${this.role}`
}
}
class Frontenddeveloper1 extends Softwaredeveloper{
constructor(name,company,role,branch){//manually creating the constructor and adding extra
super(name,company,role);
this.branch=branch;
}
}
let fdeveloper1=new Frontenddeveloper1('ponmani','solverminds','frontend','chennai');
console.log(fdeveloper1);
console.log(fdeveloper1.getdeveloper());
</script>
</body>
</html>