-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathlambda-classes.js
More file actions
124 lines (114 loc) · 3.37 KB
/
lambda-classes.js
File metadata and controls
124 lines (114 loc) · 3.37 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// CODE here for your Lambda Classes
class Person {
constructor(attrs) {
this.name = attrs.name;
this.location = attrs.location;
this.age = attrs.age;
}
speak() {
return `Hello my name is ${this.name}, and I am from ${this.location}.`
}
}
class Instructor extends Person {
constructor(attrs) {
super(attrs);
this.specialty = attrs.specialty;
this.favLanguage = attrs.favLanguage;
this.catchPhrase = attrs.catchPhrase;
}
demo(subject) {
return `Today we are learning about ${subject}`;
}
grade(student, subject) {
return `${student} receives a perfect score on ${subject}`;
}
}
class Student extends Person {
constructor(attrs){
super(attrs)
this.previousBackground = attrs.previousBackground;
this.className = attrs.className;
this.favSubjects = attrs.favSubjects;
}
listsSubjects() {
return `${this.favSubjects[favSubjects.length]}`;
}
PRAssignment(subject) {
return `${this.name} has submitted a PR for ${subject}`;
}
sprintChallenge(subject) {
return `${this.name} has begun sprint challenge on ${subject}`;
}
}
class TeamLead extends Instructor {
constructor(attrs) {
super(attrs);
this.gradClassName = attrs.gradClassName;
this.favInstructor = attrs.favInstructor;
}
standUp(slackChannel) {
return `${this.name} announces to ${slackChannel}, @channel standy times!`;
}
debugsCode(student, subject) {
return `${this.name} debugs ${student}'s code on ${subject}`
}
}
// class Person {
// constructor(attrs) {
// this.name = attrs.name;
// this.location = attrs.location;
// this.age = attrs.age;
// }
const instructor_one = new Instructor({
name: 'Charles',
location: 'Wisconsin',
age: 35,
specialty: 'Javascript',
favLanguage: 'Javascript',
catchPhrase: 'Remember the classes!'
})
const student_one = new Student({
name: 'Brenda',
location: 'Florida',
age: 22,
previousBackground: 'Retail',
className: 'WEBPT11',
favSubjects: ['Math', 'Graphic Design', 'HTML', 'CSS'],
})
const student_two = new Student({
name: 'Linda',
location: 'Colorado',
age: 24,
previousBackground: 'Customer Service Representative',
className: 'WEB22',
favSubjects: ['Creative Writing', 'Drawing101', 'Javascript', 'Music Theory']
})
const student_three = new Student({
name: 'Bob',
location: 'Kentucky',
age: 50,
previousBackground: 'Cashier',
className: 'WEBPT8',
favSubjects: ['Calculus', 'Science', 'Python', 'Drama']
})
const team_lead = new TeamLead({
name: 'Leo',
location: 'California',
age: 27,
specialty: 'Javascript',
favLanguage: 'Javascript',
catchPhrase: 'Don\'t throw me under the bus!',
gradClassName: 'WEB22',
favInstructor: 'Pace'
})
console.log(student_one.name);
console.log(instructor_one.favLanguage);
console.log(instructor_one.demo('Math'));
console.log(instructor_one.grade(student_two.name, 'Drama'));
console.log(team_lead.name);
console.log(team_lead.catchPhrase);
console.log(student_three.favSubjects);
console.log(team_lead.debugsCode(student_three.name, student_three.favSubjects[1]));
console.log(team_lead.standUp('webpt11'));
console.log(team_lead.speak());
console.log(instructor_one.speak());