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
163 lines (136 loc) · 3.98 KB
/
Copy pathlambda-classes.js
File metadata and controls
163 lines (136 loc) · 3.98 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
150
151
152
153
154
155
156
157
158
159
160
161
162
// CODE here for your Lambda Classes
class Person1 {
constructor(attributes){
this.name = attributes.name;
this.age = attributes.age;
this.location = attributes.location;
}
speak() {
return `Hello my name is ${this.name}, I am from ${this.location}.`;
}
}
const vivian = new Person1 ({
name: 'Vivian',
age: 23,
location: 'Benin'
});
const john = new Person1 ({
name: 'John',
age: 20,
location: 'Lagos'
})
console.log(vivian.speak());
console.log(john.speak());
class Instructor extends Person1 {
constructor(attributes) {
super(attributes);
this.specialty = attributes.specialty;
this.favLanguage =attributes.favLanguage;
this.catchPhrase = attributes.catchPhrase;
}
demo (subject) {
return `Today we are learning about ${subject}`
}
grade (student, subject) {
return `${student.name} receives a perfect score on ${subject}`;
}
}
const gabe = new Instructor({
name: 'Gabe',
age: 40,
location: 'London',
specialty: 'LESS',
favLanguage: 'javascript',
catchPhrase: 'Latest and greatest'
});
const ryan = new Instructor({
name: 'Ryan',
age: 30,
location: 'Carlifornia',
specialty: 'react',
favLanguage: 'Java',
catchPhrase: 'Trust the process!'
})
console.log(gabe.demo('Semantic HTML'));
console.log(gabe.grade({name:'Funmi'}, 'Flex-box'));
console.log(ryan.demo('Git'));
console.log(ryan.grade({name: 'Dami'}, 'Array prototype methods'));
class Student extends Person1 {
constructor(attributes){
super(attributes);
this.previousBackground = attributes.previousBackground;
this.className = attributes.className;
this.favSubjects = attributes.favSubjects;
}
listsSubjects () {
this.favSubjects.forEach(function(subjects){
console.log(subjects);
});
return `${this.name} favorite subjects are ${this.favSubjects}`;
}
PRAssignment (subject) {
return `${this.name} has submitted a PR for ${subject}`;
}
sprintChallenge (subject) {
return `${this.name} has begun sprint challenge on ${subject}`
}
}
const dave = new Student({
name: 'Dave',
age: 20,
location: 'Lagos',
previousBackground: 'Banker',
className: 'WEBEU3',
favSubjects: ['Html', 'CSS', 'Javascript']
})
const jessy = new Student ({
name: 'Jessy',
age: 24,
location: 'Abuja',
previousBackground: 'Auditor',
className: 'WEBEU2',
favSubjects: ['Javascript', 'Java', 'CSS']
})
console.log(dave.listsSubjects());
console.log(dave.PRAssignment('Semantic Html'));
console.log(dave.sprintChallenge(`User-Interface 1`));
console.log(jessy.listsSubjects());
console.log(jessy.PRAssignment('CSS-FlexBox display'));
console.log(jessy.sprintChallenge(`User-interface-2`));
class ProjectManagers extends Instructor {
constructor(attributes){
super(attributes);
this.gradClassName = attributes.gradClassName;
this.favInstructor = attributes.favInstructor;
}
standUp(slackChannel){
return `${this.name} announces to ${slackChannel}, @channel stand up time!`;
}
debugsCode(student, subject){
return `${this.name} debugs ${student.name}'s code on ${subject}`
}
}
const anna = new ProjectManagers ({
name: 'Anna',
age: 21,
location: 'Manchester',
specialty: 'Javascript Objects',
favLanguage: 'Javscript',
catchPhrase: 'I believe in you',
gradClassName: 'WEBEU1',
favInstructor: 'Gabe'
});
const patrick = new ProjectManagers ({
name: 'Patrick',
age: 25,
location: 'Ireland',
specialty: 'redux',
favLanguage: 'Python',
catchPhrase: 'Howdy cowgirls and cowboys',
gradClassName: 'WEBEU1',
favInstructor: 'Josh'
});
console.log(anna.standUp('webeu3_anna'));
console.log(anna.debugsCode({name:'Funmi'}, 'Javascript-2'));
console.log(patrick.standUp('webeu3_help'));
console.log(patrick.debugsCode({name:'Jessy'}, 'User-interface-3'));