forked from bloominstituteoftechnology/JavaScript-IV
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlambda-classes.js
More file actions
93 lines (82 loc) · 2.14 KB
/
Copy pathlambda-classes.js
File metadata and controls
93 lines (82 loc) · 2.14 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// CODE here for your Lambda Classes
class Person {
constructor(attributes) {
this.name = attributes.name;
this.age = attributes.age;
this.location = attributes.location;
this.gender = attributes.gender;
}
speak () {
return 'Hello my name is ${this.name}, I am from ${this.location}.'
}
}
const pete = new Person ({
name: 'Pete',
age: 18,
location: 'Florida',
gender:'M',
})
const amy = new Person ({
name:'Amy',
age: 45,
location:'Maryland',
gender:'F',
})
console.log(pete)
pete.speak()
console.log(amy)
amy.speak()
class Instructor extends Person {
constructor(chdatt) {
super(attributes);
this.specialty = chdatt.specialty;
this.favLanguage = chdatt.favLanguage;
this.catchPhrase = chdatt.catchPhrase;
}
demo(subject) {
return 'Today we are learning about ${this.subject}.'
}
grade(student) {
return '{student.name} receives a perfect score on {subject}.'
}
}
const bill = new Instructor ({
specialty = 'HTML',
favLanguage = 'HTML/CSS',
catchPhrase = 'More practice, better the coder',
})
const jamie = new Instructor ({
specialty = 'Functional Components',
favLanguage = 'Ruby',
catchPhrase = 'Channel you inner geek',
})
console.log(bill)
bill.demo()
bill.grade()
class Student extends Person {
constructor(chdatt) {
super(attributes);
this.previousBackground = chdatt.previousBackground;
this.className = chdatt.className;
this.favSubjects = chdatt.favSubjects;
}
PRAssignment () {
return '{student.name} has submitted a PR for {subject}.'
}
sprintChallenge () {
return '{student.name} has begun sprint challenge on {subject}.'
}
}
class ProjectManagers extends Instructors {
constructor(attributes) {
super(attributes);
this.gradClassName = attributes.gradClassName;
this.favInstructor = attributes.favInstructor;
}
standUp () {
return '{name} announces to {channel}, @channel standby times!'
}
debugsCode () {
return '{name} debugs {student.name}s code on {subject}.'
}
}