diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 8a2f8e8417..05ab476841 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -59,7 +59,22 @@ diff --git a/02 - JS and CSS Clock/index-START.html b/02 - JS and CSS Clock/index-START.html index 55ab1a5331..78d94124b5 100644 --- a/02 - JS and CSS Clock/index-START.html +++ b/02 - JS and CSS Clock/index-START.html @@ -63,13 +63,32 @@ 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 d5fcc3a2ae..cd609c2549 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -13,7 +13,7 @@

Update CSS Variables with JS

- + @@ -22,6 +22,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 0dcfd00f40..95bd42b7f5 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -38,29 +38,69 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + const filterInventorsBirth = inventors.filter(function(inventor) { + return inventor.year >= 1500 && inventor.year < 1600; + }); + console.table(filterInventorsBirth); // Array.prototype.map() // 2. Give us an array of the inventors first and last names + const inventorsFullName = inventors.map(inventor => `${inventor.first} ${inventor.last}`); + console.log(inventorsFullName) // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + let inventorsBirth = inventors.sort(function (a, b) { + return a.year - b.year; + }); + console.table(inventorsBirth) // Array.prototype.reduce() // 4. How many years did all the inventors live all together? + const totalYears = inventors.reduce((total, inventor) => { + return total + (inventor.passed - inventor.year); + }, 0); + console.log(totalYears); // 5. Sort the inventors by years lived + const inventorsLived = inventors.sort(function (a, b) { + return (a.passed - a.year) > (b.passed - b.year) ? -1 : 1; + }); + console.table(inventorsLived) // 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name // https://en.wikipedia.org/wiki/Category:Boulevards_in_Paris +/* const listBoulevards = document.querySelector('.mw-category'); + const links = [...listBoulevards.querySelectorALL('a')]; + const de = links + .map(link => link.textContent) + .filter(streetname => streetname.includes('de')); */ + // 7. sort Exercise // Sort the people alphabetically by last name + const peopleLastName = people.sort(function (lastOne, nextOne) { + const [aLast, aFirst] = lastOne.split(', '); + const [bLast, bFirst] = nextOne.split(', '); + return aLast > bLast ? 1 : -1; + }); + console.log(peopleLastName) // 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 sumInstanceOfData = data.reduce(function(object, item) { + console.log(object) + console.log(item) + if(!object[item]) { + object[item] = 0; + } + object[item]++; + return object; + }, {}); + console.log(sumInstanceOfData) diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index 88a4f1d1e2..05df91fbf4 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -27,6 +27,7 @@ .panels { min-height: 100vh; overflow: hidden; + display: flex; } .panel { @@ -38,12 +39,16 @@ /* Safari transitionend event.propertyName === flex */ /* Chrome + FF transitionend event.propertyName === flex-grow */ transition: - font-size 0.7s cubic-bezier(0.61,-0.19, 0.7,-0.11), - flex 0.7s cubic-bezier(0.61,-0.19, 0.7,-0.11), + font-size 0.1s , + flex 0.1s, background 0.2s; font-size: 20px; background-size: cover; background-position: center; + flex: 1; + justify-content: center; + display: flex; + flex-direction: column; } .panel1 { background-image:url(https://source.unsplash.com/gYl-UtwNg_I/1500x1500); } @@ -52,13 +57,23 @@ .panel4 { background-image:url(https://source.unsplash.com/ITjiVXcwVng/1500x1500); } .panel5 { background-image:url(https://source.unsplash.com/3MNzGlQM7qs/1500x1500); } - /* Flex Children */ + /* Flex items */ .panel > * { 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; @@ -72,6 +87,7 @@ .panel.open { font-size: 40px; + flex: 5; } @@ -106,6 +122,20 @@ diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 5a9aa7e4e8..f751acd4c9 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -18,6 +18,41 @@ diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 4ca34c7536..f723016533 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -27,16 +27,35 @@ // Some and Every Checks // Array.prototype.some() // is at least one person 19 or older? - // Array.prototype.every() // is everyone 19 or older? + function isNinteenOrOlder(el, indice, array) { + return el >= 19 + } + + const ageOfPeople = people.map(age => { + return new Date().getFullYear() - age.year + }) + + const resultOne = ageOfPeople.some(isNinteenOrOlder); + console.log(resultOne); + // Array.prototype.every() // is everyone 19 or older? + const resultTwo = ageOfPeople.every(isNinteenOrOlder); + console.log(resultTwo); + // 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 + findComment = comments.find((el) => el.id === 823423); + console.log(findComment); // Array.prototype.findIndex() // Find the comment with this ID - // delete the comment with the ID of 823423 + const isId = (el) => el.id == 823423; + console.log(comments.findIndex(isId)); + // delete the comment with the ID of 823423 + deleteComment = comments.splice(comments.findIndex(isId),1); + console.table(comments); diff --git a/08 - Fun with HTML5 Canvas/index-START.html b/08 - Fun with HTML5 Canvas/index-START.html index f70ad2059b..290936b4c8 100644 --- a/08 - Fun with HTML5 Canvas/index-START.html +++ b/08 - Fun with HTML5 Canvas/index-START.html @@ -8,6 +8,57 @@