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
125 lines (115 loc) · 3.3 KB
/
Copy pathlambda-classes.js
File metadata and controls
125 lines (115 loc) · 3.3 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
// CODE here for your Lambda Classes
class Person{
constructor(person){
this.newName = person.name;
this.newAge = person.age;
this.newLocation = person.location;
}
speak(){
return console.log(`Hello my name is ${this.newName}, I am from ${this.newLocation}`);
}
}
class Instructor extends Person{
constructor(instructor){
super(instructor);
this.newSpecialty = instructor.specialty;
this.newFavLanguage = instructor.favLanguage;
this.newCatchPhrase = instructor.catchPhrase;
}
demo(subject){
return console.log(`Today we are learning about ${subject}`);
}
grade(student, subject){
return console.log(`${student.newName} receives a perfect score on ${subject}`);
}
}
class Student extends Person{
constructor(student){
super(student);
this.newPreviousBackground = student.previousBackground;
this.newClassName = student.className;
this.newFavSubjects = student.favSubjects;
}
listsSubjects(){
console.log(this.newFavSubjects.toString());
}
PRAssignment(subject){
return console.log(`${this.newName} has submitted a PR for ${subject}`);
}
sprintChallenge(subject){
return console.log(`${this.newName} has begun sprint challenge on ${subject}`);
}
}
class ProjectManager extends Instructor{
constructor(projectmanager){
super(projectmanager);
this.newGradClassName = projectmanager.gradClassName;
this.newFavInstructor = projectmanager.favInstructor;
}
standUp(channel){
return console.log(`${this.newName} announces to ${channel}, @channel standy times!`);
}
debugsCode(student, subject){
return console.log(`${this.newName} debugs ${student.newName}'s code on ${subject}`);
}
}
const fred = new Instructor({
name: 'Fred',
location: 'Bedrock',
age: 37,
favLanguage: 'JavaScript',
specialty: 'Front-end',
catchPhrase: `Don't forget the homies`
});
const richard = new Instructor({
name: 'Richard',
location: 'Little Rock',
age: 33,
favLanguage: 'CSS',
specialty: 'Front-end',
catchPhrase: `Be there or be square`
});
const matt = new Student({
name: 'Matt',
location: 'Santa Barbara',
age: 27,
previousBackground: 'Welder',
className: 'WEB25',
favSubjects: ['Python', 'React', 'Javascript']
});
const joey = new Student({
name: 'Joey',
location: 'Portland',
age: 25,
previousBackground: 'Information Technology',
className: 'WEB25',
favSubjects: ['HTML', 'CSS', 'Javascript']
});
const drew = new ProjectManager({
name: 'Drew',
location: 'Scotts Valley',
age: 30,
favLanguage: 'Python',
specialty: 'Back-end',
catchPhrase: `When life gives you lemons, make lemonade`,
gradClassName: 'WEB13',
favInstructor: 'Britt'
});
const nick = new ProjectManager({
name: 'Nick',
location: 'Seattle',
age: 36,
favLanguage: 'Java',
specialty: 'Back-end',
catchPhrase: `Don't get ahead of yourself`,
gradClassName: 'WEB15',
favInstructor: 'Britt'
});
nick.speak();
fred.demo("React");
richard.grade(joey, "HTML");
matt.listsSubjects();
matt.PRAssignment("React");
joey.sprintChallenge("Python");
drew.standUp("#web25");
nick.debugsCode(joey, "CSS")