-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathlambda-classes.js
More file actions
149 lines (126 loc) · 3.38 KB
/
lambda-classes.js
File metadata and controls
149 lines (126 loc) · 3.38 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// CODE here for your Lambda Classes
class Person {
constructor(personObjectAttrs) {
this.name = personObjectAttrs.name;
this.age = personObjectAttrs.age;
this.location = personObjectAttrs.location;
}
speak() {
console.log(`Hello my name is ${this.name}, I am from ${this.location}`);
}
}
//Person 1
const peter = new Person({
name: "Peter",
age: 35,
location: "New Jersey"
});
console.log(peter.speak());
//Person 2
const michael = new Person({
name: "Michael",
age: 32,
location: "Nashville"
});
console.log(michael.speak());
//Instructor Class
class Instructor extends Person {
constructor(instructorAttr) {
super(instructorAttr);
this.specialty = instructorAttr.specialty;
this.favLanguage = instructorAttr.favLanguage;
this.catchPhrase = instructorAttr.catchPhrase;
}
demo(subject) {
console.log(`Today we are learning about ${subject}`);
}
grade(student, subject) {
console.log(`${student} receives a perfect score on ${subject}`);
}
}
//Instructor 1
let andrew = new Instructor({
name: "Andrew",
age: 35,
location: "LA",
specialty: "Back-end",
favLanguage: "Node.js",
catchPhrase: "Do you guys want to do a group session or 1:1s?"
});
console.log(andrew.demo("Node.js"), andrew.grade("Jane", "Javascript"));
//Instructor 2
let George = new Instructor({
name: "George",
age: 36,
location: "NewYork",
specialty: "Data Science",
favLanguage: "Python",
catchPhrase: "What is your fav back-end language?"
});
console.log(George.demo("Python"), andrew.grade("Mary", "JavaScript"));
//student
class Student extends Person {
constructor(studentAttr) {
super(studentAttr);
this.previousBackground = studentAttr.previousBackground;
this.className = studentAttr.className;
this.favSubjects = studentAttr.favSubjects;
}
listsSubjects() {
for (let i = 0; i < this.favSubjects.length; i++) {
console.log(this.favSubjects[i]);
}
}
PRAssignments(subject) {
console.log(`${this.name} has submitted a PR for ${subject}`);
}
sprintChallenge(subject) {
console.log(`${this.name} has begun sprint challenge on ${subject}`);
}
}
//Student 1
let sam = new Student({
name: "Sam",
previousBackground: "Former Truck Driver",
className: "Java Script II",
favSubjects: ["HTML", "CSS", "JS"]
});
console.log(sam.listsSubjects());
console.log(sam.PRAssignments("JS"));
console.log(sam.sprintChallenge("CSS"));
//Student 2
let ann = new Student({
name: "Ann",
previousBackground: "Secretary",
className: "Javscript III",
favSubjects: ["JS", "Python", "Data Science"]
});
console.log(ann.listsSubjects());
console.log(ann.PRAssignments("Python"));
console.log(ann.sprintChallenge("Data Science"));
class ProjectManager extends Instructor {
constructor(projectManager) {
super(projectManager);
this.gradClassName = projectManager.gradClassName;
this.favInstructor = projectManager.favInstructor;
}
standUp(slackChannel) {
console.log(
`${this.name} annouces to ${slackChannel}, @ channel standy time`
);
}
debugsCode(student, subject) {
console.log(
`${this.name} debugs ${student.className}'s code on ${subject}`
);
}
}
const jim = new ProjectManager({
gradClassName: "USC",
favInstructor: "Andrew",
name: "Jim",
age: 40,
location: "Atlanta"
});
console.log(jim.standUp("Webpt10"));
console.log(jim.debugsCode(ann, "JavaScript III"));