Repository navigation
Expand file tree
/
Copy pathlambda-classes.js
More file actions
98 lines (87 loc) · 2.34 KB
/
Copy pathlambda-classes.js
File metadata and controls
98 lines (87 loc) · 2.34 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
//------------constructors----------//
class Person {
constructor (attribute){
this.name = attribute.name;
this.age = attribute.name;
this.location = attribute.location;
this.gender = attribute.gender;
}
speak () {
return `Hello my name is ${this.name}, I am from ${this.location}.`;
}
}
class Instructor extends Person {
constructor(teachAt){
super(teachAt);
this.specialty = teachAt.specialty;
this.favLanguage = teachAt.favLanguage;
this.catchPhrase = teachAt.catchPhrase;
}
demo() {
return `Today we are learning about ${this.specialty}.`;
}
grade() {
return `${student.name} receives a perfect score on ${subject}`;
}
}
class Student extends Person {
constructor (learnAt) {
super (learnAt);
this.previousBackground = learnAt.previousBackground;
this.className = learnAt.className;
this.favSubjects = learnAt.favSubjects;
}
listsSubjects (){
this.favSubjects.forEach(function(subject){
console.log(subject);
})
}
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(pmAt) {
super (pmAt);
this.gradClassName = pmAt.gradClassName;
this.favInstructor = pmAt.favInstructor;
}
standUp (){
return `${this.name} announces to @channel standy time!`;
}
}
//------------------- Objects----------//
const agatha = new Instructor ({
name: 'Agatha',
age: 38,
location: 'Lexington',
gender: 'F',
specialty: 'Python',
favLanguage: 'C#',
catchPhrase: 'just a drop in the bucket.'
});
const jared = new Instructor ({
name: 'Jared',
age: 38,
location: 'Birmingham',
gender: 'M',
specialty: 'Framworks',
favLanguage: 'R',
catchPhrase: 'Bob\'s your uncle.'
});
const carmichael = new Student ({
name: 'Carmichael',
age: 19,
location: 'Hartford',
gender: 'M',
previousBackground: 'student',
className: 'CS132',
favSubjects: ['math', 'UI', 'Java']
});
console.log(agatha.speak());
console.log(jared.demo());
console.log(carmichael.favSubjects);
console.log(carmichael.sprintChallenge("math"))