From 6c0be2943d54bb57c9da9e6be45c9ac37f33adba Mon Sep 17 00:00:00 2001 From: Connor Leech Date: Thu, 15 Mar 2018 15:40:20 -0700 Subject: [PATCH 1/3] add day one drum kit --- 01 - JavaScript Drum Kit/index-START.html | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..0428ee56f8 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -58,7 +58,37 @@ From 2e38f965ede285c924ac8f4dee7b31a6d6f2fe21 Mon Sep 17 00:00:00 2001 From: Connor Leech Date: Fri, 16 Mar 2018 11:45:55 -0700 Subject: [PATCH 2/3] add day two --- 02 - JS and CSS Clock/index-START.html | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/02 - JS and CSS Clock/index-START.html b/02 - JS and CSS Clock/index-START.html index ee7eaefb1f..593d7be9a3 100644 --- a/02 - JS and CSS Clock/index-START.html +++ b/02 - JS and CSS Clock/index-START.html @@ -62,12 +62,39 @@ background:black; position: absolute; top:50%; + transform-origin: 100%; + transform:rotate(90deg); + transition: all 0.05s; + transition-timing-function: cubic-bezier(0.1, 2.7, 0.58, 1) } From 9681f916b6fc7f13349e8d6f38aac5fc165db7ed Mon Sep 17 00:00:00 2001 From: Connor Leech Date: Tue, 20 Mar 2018 09:34:12 -0700 Subject: [PATCH 3/3] add day 4 --- 04 - Array Cardio Day 1/index-START.html | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index eec0ffc31d..364d93e2be 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -31,17 +31,43 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + const fifteenhundreds = inventors.filter(function(inventor){ + return (inventor.year > 1499 && inventor.year < 1600); + }); + console.log(fifteenhundreds); // Array.prototype.map() // 2. Give us an array of the inventors' first and last names + const names = inventors.map(function(inventor){ + return `${inventor.first} ${inventor.last}`; + }); + console.log(names); // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + const sorted = inventors.sort(function(a, b){ + return a.year - b.year; + }); + console.log(sorted); // Array.prototype.reduce() // 4. How many years did all the inventors live? + let yearsLived = inventors.reduce(function(accumulator, current, index){ + const inventor = { + name: `${current.first} ${current.last}`, + age: current.passed - current.year + }; + accumulator.push(inventor); + return accumulator; + }, []); + console.log(yearsLived); // 5. Sort the inventors by years lived + yearsLived.sort(function(a, b){ + return b.age - a.age; + }); + console.log(yearsLived); + // 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name // https://en.wikipedia.org/wiki/Category:Boulevards_in_Paris @@ -49,10 +75,24 @@ // 7. sort Exercise // Sort the people alphabetically by last name + people.sort(function(a, b){ + return a.localeCompare(b); + }); + console.log(people); // 8. Reduce Exercise // Sum up the instances of each of these const data = ['car', 'car', 'truck', 'truck', 'bike', 'walk', 'car', 'van', 'bike', 'walk', 'car', 'van', 'car', 'truck' ]; + + let instances = data.reduce(function(accum, current, index){ + if(accum[current]){ + accum[current] += 1; + } else { + accum[current] = 1; + } + return accum; + }, {}); + console.log(instances);