diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..80344d00c5 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -58,7 +58,27 @@ diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index 8a4f0d556e..2d1a543820 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -21,6 +21,21 @@

Update CSS Variables with JS

diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index eec0ffc31d..1c15fccea8 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -32,15 +32,32 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's +const old_inventors = inventors.filter(inventor => inventor.year >= 1500 && + inventor.year < 1600) +console.table(old_inventors) + // Array.prototype.map() // 2. Give us an array of the inventors' first and last names +let full_names = inventors.map(inventor => `${inventor.first} ${inventor.last}`) +console.log(full_names) + // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest +let sorted_inventors = inventors.sort((a, b) => { + return a.year > b.year ? 1 : -1 +}) +console.table(sorted_inventors) + // Array.prototype.reduce() // 4. How many years did all the inventors live? + let yearsLived = inventors.reduce((memo, inventor) => { + return memo + (inventor.passed - inventor.year) + }, 0) +console.log(yearsLived) + // 5. Sort the inventors by years lived // 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index c6509bed02..0a7ac8c4a2 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -24,6 +24,7 @@ .panels { min-height:100vh; overflow: hidden; + display: flex; } .panel { @@ -41,6 +42,9 @@ font-size: 20px; background-size:cover; background-position:center; + flex: 1; + display: flex; + flex-direction: column; } @@ -54,8 +58,17 @@ margin:0; width: 100%; transition:transform 0.5s; + flex: 1 0 auto; + display: flex; + justify-content: center; + align-items: center; } + .panel > *:first-child { transform: translateY(-100%); } + .panel.open-active > *:first-child { transform: translateY(0); } + .panel > *:last-child { transform: translateY(100%); } + .panel.open-active > *:last-child { transform: translateY(0); } + .panel p { text-transform: uppercase; font-family: 'Amatic SC', cursive; @@ -68,6 +81,7 @@ .panel.open { font-size:40px; + flex: 5; } @@ -102,6 +116,21 @@ diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 1436886918..bdfa469516 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -17,6 +17,56 @@ diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 969566ff78..c9ae28850e 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -28,14 +28,29 @@ // Array.prototype.some() // is at least one person 19 or older? // Array.prototype.every() // is everyone 19 or older? +function wasBornIn80s(person) { + return person.year >= 1980 && person.year <= 1989 +} + + let somePeopleWerebornIn80s = people.some(person => wasBornIn80s(person)) +console.log(somePeopleWerebornIn80s) + +let allPeopleWereBornIn80s = people.every(person => wasBornIn80s(person)) +console.log(allPeopleWereBornIn80s) + // Array.prototype.find() // Find is like filter, but instead returns just the one you are looking for // find the comment with the ID of 823423 +let comment = comments.find(comment => comment.id === 523423) +console.log(comment) + // Array.prototype.findIndex() // Find the comment with this ID // delete the comment with the ID of 823423 +let index = comments.findIndex(comment => comment.id === 523423) +console.log("index:", index) diff --git a/08 - Fun with HTML5 Canvas/index-START.html b/08 - Fun with HTML5 Canvas/index-START.html index 37c148df07..d3a025e48c 100644 --- a/08 - Fun with HTML5 Canvas/index-START.html +++ b/08 - Fun with HTML5 Canvas/index-START.html @@ -7,6 +7,38 @@