From 0d5f0209d147228d6f8eb0bf484324d22ae2a2c8 Mon Sep 17 00:00:00 2001 From: blakelower Date: Thu, 17 Oct 2019 18:32:20 +0700 Subject: [PATCH 1/5] made a class --- assignments/lambda-classes.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/assignments/lambda-classes.js b/assignments/lambda-classes.js index 71acfca0e..8f413be89 100644 --- a/assignments/lambda-classes.js +++ b/assignments/lambda-classes.js @@ -1 +1,26 @@ // CODE here for your Lambda Classes +class borkers{ + constructor(attributes){ + this.name = attributes.name; + this.size = attributes.size; + this.weight = attributes.weight; + this.habitat = attributes.habitat; + this.color = attributes.color; + this.food = attributes.food; + this.sound = attributes.sound; + } + eat(){ + return `${this.name} goes to the park to eat ${this.food}`; + } +} +const flork = new borkers({ + name: 'borky bork', + size: 'big tall', + weight: 'smol', + habitat: 'with the borker', + color: 'soft', + food: 'candy', + sound: 'snerp snerp snerp', +}); +console.log(borkers); +console.log(flork); \ No newline at end of file From 691a8b7975f843e8361cf38588c8d1efe6ebc8b5 Mon Sep 17 00:00:00 2001 From: blakelower Date: Thu, 17 Oct 2019 19:19:30 +0700 Subject: [PATCH 2/5] did prototypes --- .vscode/settings.json | 3 +++ assignments/lambda-classes.js | 25 ------------------------- assignments/prototype-refactor.js | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 25 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..6f3a2913e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5501 +} \ No newline at end of file diff --git a/assignments/lambda-classes.js b/assignments/lambda-classes.js index 8f413be89..71acfca0e 100644 --- a/assignments/lambda-classes.js +++ b/assignments/lambda-classes.js @@ -1,26 +1 @@ // CODE here for your Lambda Classes -class borkers{ - constructor(attributes){ - this.name = attributes.name; - this.size = attributes.size; - this.weight = attributes.weight; - this.habitat = attributes.habitat; - this.color = attributes.color; - this.food = attributes.food; - this.sound = attributes.sound; - } - eat(){ - return `${this.name} goes to the park to eat ${this.food}`; - } -} -const flork = new borkers({ - name: 'borky bork', - size: 'big tall', - weight: 'smol', - habitat: 'with the borker', - color: 'soft', - food: 'candy', - sound: 'snerp snerp snerp', -}); -console.log(borkers); -console.log(flork); \ No newline at end of file diff --git a/assignments/prototype-refactor.js b/assignments/prototype-refactor.js index 91424c9fa..44eaa861d 100644 --- a/assignments/prototype-refactor.js +++ b/assignments/prototype-refactor.js @@ -7,3 +7,23 @@ Prototype Refactor 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. */ +function LambdaPersonnel(attributes){ + this.instructor = attributes.instructor; + this.students = attributes.students; + this.projectManagers = attributes.projectManagers; +} +LambdaPersonnel.prototype.learn = function(){ + return `${this.instructor}: teaches Javascript, ${this.students}`; +} +function Kids(attributes) { + LambdaPersonnel.call(this, attributes); +} +Kids.prototype = Object.create(LambdaPersonnel.prototype); + +const webeu4 = new LambdaPersonnel({ + instructor: 'Remi', + students: 'webeu4', + projectManagers: 'Matt Locklin', +}); + +console.log(webeu4); From 7fde31a9b031111d1d2952a780f8e518051470d1 Mon Sep 17 00:00:00 2001 From: blakelower Date: Thu, 17 Oct 2019 19:23:24 +0700 Subject: [PATCH 3/5] made a class --- assignments/lambda-classes.js | 36 ++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/assignments/lambda-classes.js b/assignments/lambda-classes.js index 71acfca0e..986179871 100644 --- a/assignments/lambda-classes.js +++ b/assignments/lambda-classes.js @@ -1 +1,35 @@ -// CODE here for your Lambda Classes +// // CODE here for your Lambda Classes +// function LambdaPersonnel(attributes){ +// this.instructor = attributes.instructor; +// this.students = attributes.students; +// this.projectManagers = attributes.projectManagers; +// } +// LambdaPersonnel.prototype.learn = function(){ +// return `${this.instructor}: teaches Javascript, ${this.students}`; +// } +// function Kids(attributes) { +// LambdaPersonnel.call(this, attributes); +// } +// Kids.prototype = Object.create(LambdaPersonnel.prototype); + +// const webeu4 = new LambdaPersonnel({ +// instructor: 'Remi', +// students: 'webeu4', +// projectManagers: 'Matt Locklin', +// }); + +// console.log(webeu4); + +class LambdaPersonnel{ + constructor (attributes){ + this.instructor = attributes.instructor; + this.students = attributes.students; + this.projectManagers = attributes.projectManagers; + } +} +const webeu4 = new LambdaPersonnel({ + instructor: 'Remi', + students: 'webeu4', + projectManagers: 'Matt Locklin', +}); +console.log(webeu4); \ No newline at end of file From 468e0efd7761b3a5408acb4ed34af58d28677f43 Mon Sep 17 00:00:00 2001 From: blakelower Date: Thu, 17 Oct 2019 20:39:18 +0700 Subject: [PATCH 4/5] push up --- assignments/lambda-classes.js | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/assignments/lambda-classes.js b/assignments/lambda-classes.js index 986179871..4cc36bcbc 100644 --- a/assignments/lambda-classes.js +++ b/assignments/lambda-classes.js @@ -1,25 +1,3 @@ -// // CODE here for your Lambda Classes -// function LambdaPersonnel(attributes){ -// this.instructor = attributes.instructor; -// this.students = attributes.students; -// this.projectManagers = attributes.projectManagers; -// } -// LambdaPersonnel.prototype.learn = function(){ -// return `${this.instructor}: teaches Javascript, ${this.students}`; -// } -// function Kids(attributes) { -// LambdaPersonnel.call(this, attributes); -// } -// Kids.prototype = Object.create(LambdaPersonnel.prototype); - -// const webeu4 = new LambdaPersonnel({ -// instructor: 'Remi', -// students: 'webeu4', -// projectManagers: 'Matt Locklin', -// }); - -// console.log(webeu4); - class LambdaPersonnel{ constructor (attributes){ this.instructor = attributes.instructor; @@ -27,7 +5,7 @@ class LambdaPersonnel{ this.projectManagers = attributes.projectManagers; } } -const webeu4 = new LambdaPersonnel({ +let webeu4 = new LambdaPersonnel({ instructor: 'Remi', students: 'webeu4', projectManagers: 'Matt Locklin', From 6f83335f7ced8dbaa2cfdc1c631808ebab4249b1 Mon Sep 17 00:00:00 2001 From: blakelower Date: Thu, 17 Oct 2019 20:51:39 +0700 Subject: [PATCH 5/5] fixed bug --- assignments/lambda-classes.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/assignments/lambda-classes.js b/assignments/lambda-classes.js index 4cc36bcbc..1ae87e228 100644 --- a/assignments/lambda-classes.js +++ b/assignments/lambda-classes.js @@ -1,13 +1,19 @@ -class LambdaPersonnel{ +class Lambda{ constructor (attributes){ this.instructor = attributes.instructor; this.students = attributes.students; this.projectManagers = attributes.projectManagers; } } -let webeu4 = new LambdaPersonnel({ +const webeu5 = new Lambda({ instructor: 'Remi', - students: 'webeu4', + students: 'webeu5', projectManagers: 'Matt Locklin', }); -console.log(webeu4); \ No newline at end of file +let webeu6 = new Lambda({ + instructor: 'Petar', + students: 'webeu6', + projectManagers: 'Debra', +}); +console.log(webeu4); +console.log(webeu6);