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
113 lines (104 loc) · 3.53 KB
/
Copy pathlambda-classes.js
File metadata and controls
113 lines (104 loc) · 3.53 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
class Person {
constructor(attr) {
this.name = attr.name
this.age = attr.age
this.location = attr.location
}
speak() {
return `Hello my name is ${this.name}, I am from ${this.location}`
}
}
class Instructor extends Person {
constructor(attr) {
super(attr)
this.specialty = attr.specialty
this.favLanguage = attr.favLanguage
this.catchPhrase = attr.catchPhrase
}
demo(subject) {
return `Today we are learning about ${subject}`
}
grade(student, string) {
return `${student.name} recieves a perfect score on ${string}`
}
changeGrade(grade) {
return (grade - Math.random())
}
}
class Student extends Person {
constructor(attr) {
super(attr)
this.previousBackground = attr.previousBackground
this.className = attr.className
this.favSubjects = attr.favSubjects
this.grade = attr.grade
}
listsSubjects(subject) {
return subject.forEach(function (i) {
console.log(i)
})
}
PRAssignment(subject) {
return `${this.name} has submitted a PR for ${subject}`
}
sprintChallenge(subject) {
return `${this.name} has begun sprint challenge on ${subject}`
}
}
class Project_Manager extends Instructor {
constructor(attr) {
super(attr)
this.gradClassName = attr.gradClassName
this.favInstructor = attr.favInstructor
}
standUp(channel) {
return `${this.name} announces to ${channel} @channel standy times!`
}
debugsCode(student, subject) {
return `${this.name} debugs ${student.name}'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 doni = new Student({
name: 'Doni',
location: 'Lardie',
age: 37,
previousBackground: 'Plummer',
className: 'Web02',
favSubjects: ["Math", "English", "NotMath"],
grade: 50,
});
const sall = new Project_Manager({
name: 'Sall',
location: 'Fnockford',
age: 37,
favLanguage: 'English?',
specialty: 'Design',
catchPhrase: `Watch my colors color`,
gradClassName: 'Web11',
favInstructor: 'Fred'
});
//Methods--------------------------------------------------------------------------------------------
console.log(sall.speak()) //--------------------------Hello my name is Sall, I am from Fnockford
console.log(sall.demo("Constructor Functions")) //----Today we are learning about Constructor Functions
console.log(sall.grade(doni, "JavaScript")) //--------Doni recieves a perfect score on JavaScript
console.log(sall.standUp("Radio")) //-----------------Sall announces to Radio @channel standy times!
console.log(sall.debugsCode(doni, "Math")) //---------Sall debugs Doni's code on Math
doni.listsSubjects(doni.favSubjects)
console.log(doni.PRAssignment("Java"))
console.log(doni.sprintChallenge("Java"))
console.log(sall.changeGrade(doni.grade))
//Random Items to Show Functionality------------------------------------------------------------------
console.log(sall.name) //-----------------------------Should Print 'Sall'
console.log(sall.location) //-------------------------Should Print Knockford
console.log(sall.age) //------------------------------37
console.log(sall.favLanguage) //----------------------English?
console.log(sall.specialty) //------------------------Design
console.log(sall.catchPhrase) //---------------------'Watch my colors color