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

class Instructor extends Person {
constructor(instructorInfo){
super(instructorInfo);
this.speacialty= instructorInfo.speacialty;
this.favLanguage= instructorInfo.favLanguage;
this.catchPhrase= instructorInfo.catchPhrase;
}
demo(subject){
console.log(`Today we are learning about ${subject}.`);
}
grade(student,subject){
console.log(`${student.name} earned a perfect score on ${subject}.`);
}
}

class Student extends Person {
constructor(studentInfo){
super(studentInfo);
this.previousBackground =studentInfo.previousBackground;
this.className= studentInfo.className;
this.favSubjects= studentInfo.favSubjects;
}
listsSubjects(){
console.log(`${this.favSubjects}`);
}
PRAssignment(subject) {
console.log(`${student.name} has submitted a PR for ${subject}.`);
}
sprintChallenge(subject){
console.log(`${student.name} has begun sprint challenge on ${subject}.`);
}
}

class Pms extends Instructor{
constructor(pmInfo){
super(pmInfo);
this.gradClassName= pmInfo.gradClassName;
this.favInstructor= pmInfo.favInstructor;
}
standUp(channel){
console.log(`${this.name} announces to ${channel}, @channel standup times!`);
}
debugsCode(student,subject){
console.log(`${this.name} debugs ${student.name}'s code on ${subject}.`);

}
}


const Josh= new Instructor({
name:'Josh',
gender:'male',
favLanguage:'JavaScript',

});

const Holly= new Pms({
name:'Holly',
gender:'female',
favInstructor:'Josh'
});

const Jared= new Student ({
name: 'Jared',
gender:'male',
age: 25,
className:'cs11'
});
59 changes: 34 additions & 25 deletions assignments/prototype-refactor.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,50 +41,59 @@ const mage = new Humanoid({
dimensions: {
length: 2,
width: 1,
height: 1
height: 1,
},
hp: 5,
name: 'Bruce',
faction: 'Mage Guild',
weapons: ['Staff of Shamalama'],
language: 'Common Toungue'
name: 'Thor',
faction: 'Asgardian',
weapons: [
'Mjolnir',
],
language: 'Native Toungue',
});

const swordsman = new Humanoid({
createdAt: new Date(),
dimensions: {
length: 2,
width: 2,
height: 2
height: 2,
},
hp: 15,
name: 'Sir Mustachio',
faction: 'The Round Table',
weapons: ['Giant Sword', 'Shield'],
language: 'Common Toungue'
name: 'Deadpool',
faction: 'Mutant',
weapons: [
'Swords',
'Guns',
'More Guns',
],
language: 'Sarcasm',
});

const archer = new Humanoid({
createdAt: new Date(),
dimensions: {
length: 1,
width: 2,
height: 4
height: 4,
},
hp: 10,
name: 'Lilith',
faction: 'Forest Kingdom',
weapons: ['Bow', 'Dagger'],
language: 'Elvish'
name: 'Joker',
faction: 'Arkham Patient ',
weapons: [
'Bombs',
'Guns',
'Mob',
],
language: 'English 1940s street slang',
});

console.log(mage.createdAt); // Today's date
console.log(archer.dimensions); // { length: 1, width: 2, height: 4 }
console.log(swordsman.hp); // 15
console.log(mage.name); // Bruce
console.log(swordsman.faction); // The Round Table
console.log(mage.weapons); // Staff of Shamalama
console.log(archer.language); // Elvish
console.log(archer.greet()); // Lilith offers a greeting in Elvish.
console.log(mage.takeDamage()); // Bruce took damage.
console.log(swordsman.destroy()); // Sir Mustachio was removed from the game.
console.log(mage.createdAt);
console.log(archer.dimensions);
console.log(swordsman.hp);
console.log(swordsman.faction);
console.log(mage.weapons);
console.log(archer.language);
console.log(archer.greet());
console.log(mage.takeDamage());
console.log(swordsman.destroy());