From cabb460913a9a3b374334753a84a347eb1117a6a Mon Sep 17 00:00:00 2001 From: Andrew Muto Date: Fri, 22 May 2020 11:13:24 -0400 Subject: [PATCH 1/3] Began sprint --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index cc6d6902fb..d9982bdaf7 100644 --- a/README.md +++ b/README.md @@ -39,11 +39,11 @@ Edit this document to include your answers after each question. Make sure to lea Follow these steps to set up and work on your project: Make sure you clone the branch that the TK links to: the vnext branch, NOT master! -- [ ] Create a forked copy of this project. -- [ ] Add TL as collaborator on Github. -- [ ] Clone your OWN version of Repo (Not Lambda's by mistake!). -- [ ] Create a new Branch on the clone: git checkout -b ``. -- [ ] Create a pull request before you start working on the project requirements. You will continuously push your updates throughout the project. +- [x] Create a forked copy of this project. +- [x] Add TL as collaborator on Github. +- [x] Clone your OWN version of Repo (Not Lambda's by mistake!). +- [x] Create a new Branch on the clone: git checkout -b ``. +- [] Create a pull request before you start working on the project requirements. You will continuously push your updates throughout the project. - [ ] You are now ready to build this project with your preferred IDE - [ ] Implement the project on your Branch, committing changes regularly. - [ ] Push commits: git push origin ``. From d551b835cff7ea572fc452edb88ca53f3ecb4dfb Mon Sep 17 00:00:00 2001 From: Andrew Muto Date: Fri, 22 May 2020 13:22:38 -0400 Subject: [PATCH 2/3] Worked on Arrays and Callbacks --- challenges/arrays-callbacks.js | 40 ++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/challenges/arrays-callbacks.js b/challenges/arrays-callbacks.js index 472ab3e96d..8085573502 100644 --- a/challenges/arrays-callbacks.js +++ b/challenges/arrays-callbacks.js @@ -21,6 +21,12 @@ The zoos want to display both the scientific name and the animal name in front o */ const displayNames = []; + function getNames(item){ + zooAnimals.forEach(function(item){ + const names = animal_name && scientific_name; + return names.push.displayNames(`Name:${"animal_name"} Scientific:${"scientific_name"}`); + }); +} console.log(displayNames); /* Request 2: .map() @@ -30,6 +36,11 @@ The zoos need a list of all their animal's names (animal_name only) converted to */ const lowCaseAnimalNames = []; + function getNames(item){ + zooAnimals.map(function(myArray){ + return myArray["animal_name"].push.lowCaseAnimalNames(); + }); +} console.log(lowCaseAnimalNames); /* Request 3: .filter() @@ -38,6 +49,15 @@ The zoos are concerned about animals with a lower population count. Using filter */ const lowPopulationAnimals = []; +function getPop(item){ + const result = zooAnimals.filter(function(item){ + if ( + population < 5 + ){ + result.push.lowPopulationAnimals + } + }); +} console.log(lowPopulationAnimals); /* Request 4: .reduce() @@ -46,6 +66,9 @@ The zoos need to know their total animal population across the United States. Fi */ const populationTotal = 0; +function totalAnimalPop(item){ + const result = zooAnimals.reduce(callback, value) +} console.log(populationTotal); @@ -57,6 +80,9 @@ console.log(populationTotal); * The last parameter accepts a callback * The consume function should return the invocation of cb, passing a and b into cb as arguments */ +function consume(a, b, cb){ +return cb(a,b); +} /* Step 2: Create several functions to callback with consume(); @@ -64,13 +90,19 @@ console.log(populationTotal); * Create a function named multiply that returns the product of two numbers * Create a function named greeting that accepts a first and last name and returns "Hello first-name last-name, nice to meet you!" */ +function add(num1, num2){ + const sum = num1 + num2 + return sum +} +function greeting(first, last){ + return `Hello ${first} ${last}, nice to meet you!` +} /* Step 3: Check your work by un-commenting the following calls to consume(): */ -// console.log(consume(2, 2, add)); // 4 -// console.log(consume(10, 16, multiply)); // 160 -// console.log(consume("Mary", "Poppins", greeting)); // Hello Mary Poppins, nice to meet you! - +console.log(consume(2, 2, add)); // 4 +console.log(consume(10, 16, multiply)); // 160 +console.log(consume("Mary", "Poppins", greeting)); // Hello Mary Poppins, nice to meet you! From 4b5c50e42d28b543d58c6e3cfaeba7663cee87e2 Mon Sep 17 00:00:00 2001 From: Andrew Muto Date: Fri, 22 May 2020 20:09:57 -0400 Subject: [PATCH 3/3] Worked on Arrays and Callbacks --- challenges/arrays-callbacks.js | 18 +++++++----------- challenges/index.html | 4 ++-- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/challenges/arrays-callbacks.js b/challenges/arrays-callbacks.js index 8085573502..069e486016 100644 --- a/challenges/arrays-callbacks.js +++ b/challenges/arrays-callbacks.js @@ -21,12 +21,10 @@ The zoos want to display both the scientific name and the animal name in front o */ const displayNames = []; - function getNames(item){ - zooAnimals.forEach(function(item){ - const names = animal_name && scientific_name; - return names.push.displayNames(`Name:${"animal_name"} Scientific:${"scientific_name"}`); +zooAnimals.forEach(function(item){ + displayNames.push(item.animal_name `Name:${"animal_name"}`); + displayNames.push(item.scientific_name `Scientific:${"scientific_name"}`); }); -} console.log(displayNames); /* Request 2: .map() @@ -36,12 +34,10 @@ The zoos need a list of all their animal's names (animal_name only) converted to */ const lowCaseAnimalNames = []; - function getNames(item){ - zooAnimals.map(function(myArray){ - return myArray["animal_name"].push.lowCaseAnimalNames(); - }); -} -console.log(lowCaseAnimalNames); +zooAnimals.map(function(myArray){ + lowCaseAnimalNames.push(myArray.animal_name.toLowerCase()); +}); +console.log(lowCaseAnimalNames); /* Request 3: .filter() diff --git a/challenges/index.html b/challenges/index.html index 5772804b7f..0dc5ec27dd 100644 --- a/challenges/index.html +++ b/challenges/index.html @@ -7,8 +7,8 @@ Sprint Challenge - - + +