forked from bittu1040/JavaScript-Coding-and-Notes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClass.js
More file actions
27 lines (21 loc) · 602 Bytes
/
Class.js
File metadata and controls
27 lines (21 loc) · 602 Bytes
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
class Person {
constructor(fname, lname){
this.firstName= fname;
this.lastName= lname;
}
getFullName(){
return this.firstName+ " " + this.lastName
}
}
class CompleteDetails extends Person {
constructor(age, city, fname, lname){
super(fname, lname)
this.age= age;
this.city= city;
}
getCompleteDetails(){
return this.firstName+ " " + this.lastName + " " + this.city + " " + this.age
}
}
const completeDetails= new CompleteDetails(12, "blr", "bittu", "kumar")
console.log(completeDetails.getCompleteDetails())