8000 finished javascript-5 by YaniWessi · Pull Request #694 · bloominstituteoftechnology/JavaScript-IV · GitHub
[go: up one dir, main page]

Skip to content

finished javascript-5 #694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
56 changes: 56 additions & 0 deletions assignments/lambda-classes.js
Original file line number Diff line number Diff line change
@@ -1 +1,57 @@
// CODE here for your Lambda Classes
class person {
contructor(prop) {
this.name = prop.name;
this.age = prop.age;
this.location = prop.location;
}
phrase() {
console.log(`Hello, my ${this.name} I am from ${this.location}`);
}
}

class student extends person {
contructor(prop){
super(prop);
this.previousBackground = prop.previousBackground;
this.className = prop.className;
this.favoriteSubjects = prop.favoriteSubject;
}
listSubject(){
this.favoriteSubjects.foreach(element => console.log(element));
}
PRAssigment(subject){
console.log(`${this.name} has submited a pr for ${subject}`);
}
sprintChallenge(subject){
console.log ( `${this.name} has begun sprint challenge on ${subject}`)
}
}
class instructor extends person{
constructor(prop){
super(prop);
this. specialty = prop.specialty;
this. favLanguage = prop.favLanguage;
this.catchPhrase = prop.catchPhrase;

}

demo(subject){
console 8000 .log(`today we are learning about ${subject}`)
}
grade(student,subject){
console.log(`${student.name} recieves a perfect score on ${subject}`)
}
}
class ProjectManger extends instructor {
contructor(prop){
super(prop);
this.gradeClassName = prop.gradeClassName;
this.favoriteinstructor = prop.favoriteinstructor;
}

standUp(slack){
console.log(`${this.name} annouces to ${student.name}'s code on ${subject}`)
}
}

77 changes: 77 additions & 0 deletions assignments/prototype-refactor.js
8000
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,84 @@
Prototype Refactor

1. Copy and paste your code or the solution from yesterday
function GameObject(video) {
this.createdAt = video.createdAt;
this.name = video.name;
this.dimensions = video.dimensions;
}
GameObject.prototype.destroy = function() {
return `${this.name} was removed from the game.`;
};

function CharacterStats(attribute) {
GameObject.call(this,attribute);
this.healthPoints = attribute.healthPoints;
}
//This is the inheritance
CharacterStats.prototype = Object.create(GameObject.prototype);
//Prototype Method is Created Here
CharacterStats.prototype.takeDamage = function() {
return `returns the string ${this.name} took damage.`
}

console.log(firstNamesAllCaps);
let firstNamesAllCaps = runners.map(function(currentValue){
return currentValue.first_name.toUpperCase();});
console.log(firstNamesAllCaps);


let runnersLargeSizeShirt = [];

runnersLargeSizeShirt = runners.filter(function(currentValue){
return currentValue.shirt_size === "L";


})
console.log(runnersLargeSizeShirt);


let ticketPriceTotal = 0;
ticketPriceTotal = runners.reduce(function(accumulator, currentValue){
return accumulator + currentValue.donation;
},0)
console.log(ticketPriceTotal);

2. 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.

*/
class GameObject {
contructor(obj) {
this.createdAt = video.createdAt;
this.name = video.name;
this.dimensions = video.dimensions;
}
destroy() {
return `${this.name} was removed from the game.`;
}
}
class CharacterStats {
contructor(obj){
super(obj)
this.healthPiont = obj.healthPionts;
}
takeDamage() {
this.healthPiont = 1;
return `${this.name} took damage`;
}
}

class humaniod extends CharacterStats {
contructor(obj){
super();
this.team = obj.team;
this.weapon = obj.weapon;
this.language = obj.language;
}
greet() {
return `${name} offer greeting in ${language} @channel standy`;
}

debug(student,subject){
console.log(`${this.name} debugs `)
}
}
0