diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..ba1eef079b 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -58,7 +58,24 @@ diff --git a/02 - JS and CSS Clock/index-START.html b/02 - JS and CSS Clock/index-START.html index ee7eaefb1f..fbbf4b96c8 100644 --- a/02 - JS and CSS Clock/index-START.html +++ b/02 - JS and CSS Clock/index-START.html @@ -62,12 +62,37 @@ 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/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index 8a4f0d556e..d595b552b8 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -21,7 +21,19 @@

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..6029565197 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -31,29 +31,83 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + console.log("1. Filter the list of inventors for those who were born in the 1500's"); + const fifteen = inventors.filter(function(inventor){ + if (inventor.year >= 1500 && inventor.year < 1600) { + return true; + } + }); + console.table(fifteen); // Array.prototype.map() // 2. Give us an array of the inventors' first and last names + console.log("2. Give us an array of the inventors: First & last name"); + const fullNames = inventors.map(inventor => inventor.first + ' ' + inventor.last); + console.table(fullNames); // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + console.log("3. Sort the inventors by birthdate: oldest to youngest"); + const birth = inventors.sort(function(a, b){ + if (a.year > b.year) { + return 1; + }else{ + return -1; + } + }); + console.table(birth); // Array.prototype.reduce() // 4. How many years did all the inventors live? + console.log("4. How many years did all the inventors live?"); + const lived = inventors.reduce((total,inventor) => { + return total + (inventor.passed - inventor.year); + },0); + console.log(lived); // 5. Sort the inventors by years lived + console.log("5. Sort the inventors by years lived"); + const sortLived = inventors.sort(function(a, b){ + if ((a.passed - a.year)> (b.passed - b.year)) { + return 1; + }else { + return -1; + } + }); + console.table(sortLived); // 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name // https://en.wikipedia.org/wiki/Category:Boulevards_in_Paris - + /*console.log("6. Create a list of Boulevards in Paris that contain 'de' anywhere in the name"); + const category = document.querySelector('mw-category'); + const links = Array.from(category.querySelectorAll('a')); + const de = .map(link => link.textContent) + .filter(streetName => streetName.includes('de'));*/ // 7. sort Exercise // Sort the people alphabetically by last name - + console.log("7. Sort the people alphabetically by last name"); + const alphabet = inventors.sort(function(a, b){ + if (a.last > b.last) { + return 1; + }else{ + return -1; + } + }); + console.table(alphabet); // 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' ]; + const transportation = data.reduce(function(obj, item){ + if (!obj[item]) { + obj[item] = 0; + } + obj[item]++; + return obj; + },{}); + console.log(transportation); + - + \ No newline at end of file diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index c6509bed02..94e917a009 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,11 @@ font-size: 20px; background-size:cover; background-position:center; + flex: 1; + justify-content: center; + align-items: center; + display: flex; + flex-direction: column; } @@ -54,8 +60,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; @@ -67,6 +82,7 @@ } .panel.open { + flex: 5; font-size:40px; } @@ -102,7 +118,16 @@ diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 1436886918..8896a6baea 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -17,6 +17,43 @@ diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 969566ff78..7a2d43bfe8 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -26,15 +26,53 @@ // Some and Every Checks // Array.prototype.some() // is at least one person 19 or older? + console.log('Is at least one person 19 or older?'); + const older = people.some(function(person){ + const currentYear = (new Date()).getFullYear(); + if (currentYear - person.year >= 19) { + return true; + } + }); + console.log({older}); + // Array.prototype.every() // is everyone 19 or older? + console.log('Is everyone 19 or older?'); + const everyoneOlder = people.every(function(person){ + const currentYear = (new Date()).getFullYear(); + if (currentYear - person.year >= 19) { + return true; + } + }); + console.log({everyoneOlder}); // 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 + console.log('Find the comment with the ID 823423'); + const find = comments.find(function(people){ + if(people.id == 823423){ + return true; + } + }); + console.log(find); // Array.prototype.findIndex() // Find the comment with this ID // delete the comment with the ID of 823423 + console.log('Find the comment with this ID'); + console.log('Delete the comment with the ID of 823423'); + const findIndex = comments.findIndex(function(people){ + if(people.id == 823423){ + return true; + } + }); + console.log(findIndex); + const newComments = [ + ...comments.slice(0, findIndex), + ...comments.slice(findIndex + 1) + ]; + + diff --git a/08 - Fun with HTML5 Canvas/index-START.html b/08 - Fun with HTML5 Canvas/index-START.html index 37c148df07..46e984b329 100644 --- a/08 - Fun with HTML5 Canvas/index-START.html +++ b/08 - Fun with HTML5 Canvas/index-START.html @@ -5,8 +5,53 @@ HTML5 Canvas - + diff --git a/17 - Sort Without Articles/index-START.html b/17 - Sort Without Articles/index-START.html index 9bbd250a9b..4fe2e844bd 100644 --- a/17 - Sort Without Articles/index-START.html +++ b/17 - Sort Without Articles/index-START.html @@ -45,8 +45,22 @@ diff --git a/18 - Adding Up Times with Reduce/index-START.html b/18 - Adding Up Times with Reduce/index-START.html index abdf4c91af..3f5101c093 100644 --- a/18 - Adding Up Times with Reduce/index-START.html +++ b/18 - Adding Up Times with Reduce/index-START.html @@ -182,6 +182,25 @@