-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoop.js
More file actions
50 lines (27 loc) · 626 Bytes
/
Copy pathoop.js
File metadata and controls
50 lines (27 loc) · 626 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class Animal{
constructor(name, age, isMammal){
this.name = name;
this.age = age;
this.isMammal = isMammal;
}
}
class Rabbit extends Animal{
constructor(name, age){
super(name, age);
this.isMammal = true
}
eat(){
return(`${this.name} sedang makan!`);
}
}
class Eagle extends Animal{
constructor(name, age){
super(name, age);
this.isMammal = false;
}
fly(){
return (`${this.name} sedang terbang!`);
}
}
const myRabbit = new Rabbit("Labi", 2);
const myEagle = new Eagle("Elo", 4);