Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# JavaScript IV
<!-- # JavaScript IV

This challenge focuses on classes in JavaScript using the new `class` keyword.

Expand Down Expand Up @@ -28,10 +28,9 @@ const fred = new Person({
## `prototype-refactor` - Take existing code and make it modern.

* You're going to work with your prototypes assignment you built out yesterday.
* `Challenge:` **Convert** all of your constructors into ES6 Classes using the `class` and `extends` keywords. You should be able to run your same logs and they should build out the proper expected behaviors.
* `Challenge:` **Convert** all of your constructors into ES6 Classes using the `class` and `extends` keywords. You should be able to run your same logs and they should build out the proper expected behaviors. -->

## `lambda-classes` - We need a roster of Lambda School personnel. Build it!

* We have a school to build here! This project will get you used to thinking about classes in JavaScript and building them from a brand new data set.
* Lambda personnel can be broken down into three different types of `people`.
* **Instructors** - extensions of Person
Expand All @@ -51,15 +50,14 @@ const fred = new Instructor({
});
```

#### Person
<!-- #### Person

* First we need a Person class. This will be our `base-class`
* Person receives `name` `age` `location` `gender` all as props
* Person receives `speak` as a method.
* This method logs out a phrase `Hello my name is Fred, I am from Bedrock` where `name` and `location` are the object's own props

#### Instructor
* This method logs out a phrase `Hello my name is Fred, I am from Bedrock` where `name` and `location` are the object's own props -->

<!-- #### Instructor
* Now that we have a Person as our base class, we'll build our Instructor class.
* Instructor uses the same attributes that have been set up by Person
* Instructor has the following unique props:
Expand All @@ -68,7 +66,7 @@ const fred = new Instructor({
* `catchPhrase` i.e. `Don't forget the homies`
* Instructor has the following methods:
* `demo` receives a `subject` string as an argument and logs out the phrase 'Today we are learning about {subject}' where subject is the param passed in.
* `grade` receives a `student` object and a `subject` string as arguments and logs out '{student.name} receives a perfect score on {subject}'
* `grade` receives a `student` object and a `subject` string as arguments and logs out '{student.name} receives a perfect score on {subject}' -->

#### Student

Expand Down
2 changes: 1 addition & 1 deletion assignments/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>JS IV</title>
<title>JS IV</title>

<script src="prototype-refactor.js"></script>
<script src="lambda-classes.js"></script>
Expand Down
136 changes: 136 additions & 0 deletions assignments/lambda-classes.js
Original file line number Diff line number Diff line change
@@ -1 +1,137 @@
// CODE here for your Lambda Classes

class Person {
constructor(perAttributes) {
this.name = perAttributes.name;
this.age = perAttributes.age;
this.location = perAttributes.location;
this.gender = perAttributes.gender;
}

speak() {
return `Hello, my name is ${this.name}. I am from ${this.location}.`;
}
};

class Instructor extends Person {
constructor(instAttributes) {
super(instAttributes);

this.specialty = instAttributes.specialty;
this.favLanguage = instAttributes.favLanguage;
this.catchPhrase = instAttributes.catchPhrase;
}

demo(subject) {
return `Today, we are learning about ${subject}.`
};

grade(student, subject) {
return `${student} receives a perfect score on ${subject}.`
};
};

class Student extends Person {
constructor(stuAttributes) {
super(stuAttributes);

this.previousBackground = stuAttributes.previousBackground;
this.className = stuAttributes.className;
this.favSubjects = stuAttributes.favSubjects;
}

listsSubjects() {
return `${this.favSubjects}`;
};

PRAssignment(subject) {
return `${this.name} has submitted a PR for ${subject}.`;
};

sprintChallenge(subject) {
return `${this.name} has begun spring challenge on ${subject}.`;
};
}

class ProjMgr extends Instructor {
constructor(pmAttributes) {
super(pmAttributes);

this.gradClassName = pmAttributes.gradClassName;
this.favInstructor = pmAttributes.favInstructor;
this.standUp = pmAttributes.standUp;
}

debugsCode(subject) {
return `${this.name} debugs ${student.name}'s code on ${subject}.`
}
}

const larry = new Person({
name: "Larry",
age: 20,
location: "Maryland",
gender: 'male'
});

const jerry = new Person({
name: "Jerry",
age: 50,
location: "Texas",
gender: 'male'
});

console.log(larry.speak());

const laura = new Instructor({
name: "Laura",
age: 29,
location: "Montana",
gender: 'female',
specialty: "CSS",
favLanguage: ["jquery", "Node"]

});

const jack = new Instructor({
name: "Jack",
age: 50,
location: "Canada",
gender: 'male',
specialty: "bootstrap",
favLanguage: ["JS", "HTML"]
});

console.log(laura.demo("the DOM"));
console.log(jack.grade(jack.name, "JS IV"))


const lane = new Student({
name: "Lane",
age: 88,
location: "Missouri",
gender: 'male',
specialty: "LESS",
favLanguage: ["JS", " Python", " Golang"],
previousBackground: "construction",
className: "CS1",
favSubjects: ["Python", " Golang"]
});

const joy = new Student({
name: "Joy",
age: 90,
location: "Toronto",
gender: 'female',
specialty: "redux",
favLanguage: ["Ruby", " Haskel", " Go"],
previousBackground: "nail art",
className: "CS15",
favSubjects: ["HTML", "SASS"]
});

console.log(lane.listsSubjects());
console.log(lane.PRAssignment("React I"));
console.log(lane.sprintChallenge("Ruby"));

console.log(joy.sprintChallenge("Redux II"));
Loading