-
Notifications
You must be signed in to change notification settings - Fork 0
/
ES6Classes.js
30 lines (24 loc) · 744 Bytes
/
ES6Classes.js
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
class Person {
constructor (firstName, lastName){
this.firstName = firstName; this.lastName = lastName;
}
greeting(){
return `Hi, ${this.firstName} ${this.lastName}`;
}
}
class Customer extends Person {
constructor(firstName, lastName, phone, membership) {
super(firstName, lastName);
this.phone = phone;
this.membership = membership;
}
greetCustomer(){
return `${super.greeting()} I'm ${this.firstName} ${this.lastName}`;
}
static staticMethod(){
return "Yo Yo bitch!";
}
}
let customer = new Customer('John','Doe','12345','Premium');
console.log(customer.greetCustomer());
console.log(customer.greeting());console.log(Customer.staticMethod());