diff --git a/assignments/lambda-classes.js b/assignments/lambda-classes.js index 71acfca0e..0c030458c 100644 --- a/assignments/lambda-classes.js +++ b/assignments/lambda-classes.js @@ -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.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}`) + } +} + diff --git a/assignments/prototype-refactor.js b/assignments/prototype-refactor.js index 91424c9fa..2afe19379 100644 --- a/assignments/prototype-refactor.js +++ b/assignments/prototype-refactor.js @@ -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 `) + } +} \ No newline at end of file