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
115 changes: 115 additions & 0 deletions assignments/lambda-classes.js
Original file line number Diff line number Diff line change
@@ -1 +1,116 @@
// CODE here for your Lambda Classes
class Person {
constructor(props) {
this.name = props.name;
this.age = props.age;
this.location = props.location;
this.gender = props.gender;
}
speak() {
console.log(`Hello my name is ${this.name}, I am from ${this.location}`);
}
}

class Instructor extends Person {
constructor(props) {
super(props);
this.specialty = props.specialty;
this.favLanguage = props.favLanguage;
this.catchPhrase = props.catchPhrase;
}

demo(subject) {
console.log(`Today we are learning about ${subject}`);
}

grade(student, subject) {
console.log(`${student.name} receives a perfect score on ${subject}`);
}
} // Instructor


class Student extends Person {
constructor(props) {
super(props);
this.previousBackground = props.previousBackground;
this.className = props.className;
this.favSubjects = props.favSubjects;
}

listsSubjects() {
for (let i = 0; i < this.favSubjects.length; i++) {
console.log(`${this.name} <3's ${this.favSubjects[i]}`);
}
}

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

sprintChallenge(subject) {
console.log(`${this.name} begins working hard on ${subject}`);
}
}

class ProjectManager extends Instructor {
constructor(props) {
super(props);
this.gradClassName = props.gradClassName;
this.favInstructor = props.favInstructor;
}

standUp(channel) {
console.log(`${this.name} announces to ${channel}, @channel standy times!`);
}

debugsCode(student, subject) {
console.log(`${this.name} debugs ${student.name}'s code on ${subject}`);
}
}

const fred = new Instructor({
name: 'Fred',
location: 'Bedrock',
age: 37,
gender: 'male',
favLanguage: 'JavaScript',
specialty: 'Front-end',
catchPhrase: `Don't forget the homies`
});

const bill = new ProjectManager({
name: 'Bill',
location: 'Michigan',
age: 32,
gender: 'female',
gradClassName: 'CS1',
favInstructor: 'Luis',
favLanguage: 'JavaScript',
specialty: 'Auth',
catchPhrase: 'Redux Rocks!'
});

const figg = new Student({
name: 'Figgy',
location: 'Charleston',
age: 37,
gender: 'male',
previousBackground: 'Fork Lift Operator',
className: 'CS11',
favSubjects: ['Html', 'CSS', 'JavaScript']
});

fred.speak();
fred.demo('variables');
fred.grade(figg, 'redux');

figg.speak();
figg.listsSubjects();
figg.PRAssignment('Redux');
figg.sprintChallenge('Pre-proccessing');

bill.speak();
bill.demo('Redux');
bill.grade(figg, 'const vs let');
bill.debugsCode(figg, 'DS-Algos');
bill.standUp('#Code-Allstars');
24 changes: 14 additions & 10 deletions assignments/prototype-refactor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,41 @@
// Today your goal is to refactor all of this code to use ES6 Classes.
// The console.log() statements should still return what is expected of them.

function GameObject(options) {

class GameObject{

constructor{attributes}
this.createdAt = options.createdAt;
this.dimensions = options.dimensions;
}

GameObject.prototype.destroy = function() {

destroy() {
return `Object was removed from the game.`;
};

function CharacterStats(characterStatsOptions) {
}
class CharacterStats {
GameObject.call(this, characterStatsOptions);
this.hp = characterStatsOptions.hp;
this.name = characterStatsOptions.name;
}

CharacterStats.prototype = Object.create(GameObject.prototype);
CharacterStats = Object.create(GameObject);

CharacterStats.prototype.takeDamage = function() {
class CharacterStatsn() {
return `${this.name} took damage.`;
};

function Humanoid(humanoidOptions) {
class Humanoid() {
constructor (attributes)
CharacterStats.call(this, humanoidOptions);
this.faction = humanoidOptions.faction;
this.weapons = humanoidOptions.weapons;
this.language = humanoidOptions.language;
}

Humanoid.prototype = Object.create(CharacterStats.prototype);
Humanoid = Object.create(CharacterStats.prototype);

Humanoid.prototype.greet = function() {
greet() {
return `${this.name} offers a greeting in ${this.language}.`;
};

Expand Down