-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.js
45 lines (37 loc) · 842 Bytes
/
test.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
class Cat {
constructor (catName, catAge) {
this.catName = ''
this.catAge = 20
}
speak (words) {
let dog = new Dog('Name', 123)
return 34
}
displayAge () {
console.log(`${this.catName} is ${this.catAge}.`)
}
}
class Animal {
constructor (name, age, isADog) {
this.dogName = 'test-string'
this.dogAge = 0
this.isADog = false
}
walk () {
console.log('walking')
}
}
class Dog extends Animal {
constructor (dogName, dogAge) {
this.dogName = 'test-string'
this.dogAge = 0
this.catFriend = new Cat("Patchy", 29)
}
speak () {
console.log(`${this.dogName} makes a noise.`)
return 'MyString'
}
displayAge () {
console.log(`${this.dogName} is ${this.dogAge}.`)
}
}