Repository navigation
Expand file tree
/
Copy pathlambda-classes.js
More file actions
118 lines (102 loc) · 2.36 KB
/
Copy pathlambda-classes.js
File metadata and controls
118 lines (102 loc) · 2.36 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
// CODE here for your Lambda Classes
class Person {
constructor (obj) {
this.name = obj.name;
this.age = obj.age;
this.location = obj.location;
this.gender = obj.gender;
}
speak() {
return `Hello, my name is ${this.name}, I am from ${this.location}`;
}
}
class Instructor extends Person {
constructor (obj) {
super(obj);
this.speciality = obj.speciality;
this.favLanguage = obj.favLanguage;
this.catchPhrase = obj.catchPhrase;
}
demo(subject) {
return `Today we are learning about ${subject}.`
}
grade(student,subject) {
return `${student.name} receives a perfect score on ${subject}`;
}
}
class Student extends Person {
constructor(obj) {
super(obj);
this.previousBackground = obj.previousBackground;
this.className = obj.className;
this.favSubjects = obj.favSubjects;
}
listsSubjects() {
return this.favSubjects.map(function (x) {console.log(x);})
}
PRAssignment(subject) {
return `${this.name} has submitted a PR for ${subject}.`
}
sprintChallenge(subject) {
return `${this.name} has begun sprint challenge on ${subject}`;
}
}
class ProjectManager extends Instructor {
constructor(obj) {
super(obj);
this.gradClassName = obj.gradClassName;
this.favInstructor = obj.favInstructor;
}
standUP(channel) { return `${obj.name} announces to ${channel}, @channel standy times!`;}
debugsCode(student,subject) {return `${obj.name} debugs ${student.name}'s code on ${subject}`;}
}
const caleb = new Student ({
name: 'Caleb'
,
age: 34
,
location: 'Africa'
,
gender: 'Male'
,
previousBackground: 0
,
className:'PT2'
,
favSubjects: ['Chess','Math','Functions']
,
})
caleb.sprintChallenge('Functions')
const alison = new Student ({
name: 'Alison'
,
age: 25
,
location: 'Florida'
,
gender: 'Female'
,
previousBackground: 5
,
className:'PT2'
,
favSubjects: ['Chess','Math','Functions']
,
})
const eric = new Instructor ({
name: 'Eric'
,
age: 45
,
location: 'Russia'
,
gender: 'Male'
,
speciality: 'Java'
,
favLanguage:'Chinese'
,
catchPhrase: 'Do or do not! There is no try.'
,
})
eric.speak()