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 @@ 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) } 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);