diff --git a/01 - JavaScript Drum Kit/.vscode/settings.json b/01 - JavaScript Drum Kit/.vscode/settings.json new file mode 100644 index 0000000000..20af2f68a6 --- /dev/null +++ b/01 - JavaScript Drum Kit/.vscode/settings.json @@ -0,0 +1,3 @@ +// Place your settings in this file to overwrite default and user settings. +{ +} \ No newline at end of file diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..86769799e5 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -59,6 +59,24 @@ diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 2712384201..040bedc059 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -61,12 +61,36 @@ 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 7171607a8b..79a075d87a 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -21,7 +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 4162bce339..ceea5c34c1 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -33,29 +33,65 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + const fifteen = inventors.filter( item => item.year >=1500 && item.year <1600) + // console.table(fifteen); // Array.prototype.map() // 2. Give us an array of the inventors' first and last names + const inventor = inventors.map(item => item.first + ' ' + item.last); + // console.log(inventor); // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + const sorted = inventors.sort((a, b) => a.year > b.year ? 1 : -1); + // console.table(sorted); // Array.prototype.reduce() // 4. How many years did all the inventors live? + const life = inventors.reduce((start, item) =>{ + return start + (item.passed - item.year) + }, 0) + // console.log(life); // 5. Sort the inventors by years lived + const longLife = inventors.sort( (a, b) => { + return a.passed - a.year > b.passed - b.year ? -1 : 1; + }) + // console.table(longLife); // 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 category = document.querySelector('.mw-category') + // const links = Array.from(category.querySelectorAll('a')) + // const road = links + // .map(link=> link.textContent) + // .filter(street=>street.indexOf('de') !== -1); // 7. sort Exercise // Sort the people alphabetically by last name + + const lastName = people.sort((a, b) => { + const first = a.split(', '); + const next = b.split(', '); + return first[0] > next[0] ? 1 : -1 + }) + // console.log(lastName); + // 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(start, item) { + if (!start[item]) { + start[item] = 1 + } else { + start[item]++; + } + return start; + }, {}) + console.log(transportation); + diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index e1d643ad5c..7f4287a191 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,12 @@ font-size: 20px; background-size:cover; background-position:center; + flex:1; + justify-content: center; + align-items:center; + display:flex; + flex-direction: column; + } @@ -54,8 +61,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 +84,7 @@ .panel.open { font-size:40px; + flex:5; } .cta { @@ -107,7 +124,20 @@ diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 1436886918..d97acf1b36 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -17,6 +17,44 @@ diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 206ec31aa0..5a5f91b819 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -24,6 +24,20 @@ { text: 'Nice Nice Nice!', id: 542328 } ]; +// const ofAge = people.some(function(person) { +// const currYear = (new Date()).getFullYear(); +// if(currYear - person.year >= 19) { +// return true; +// } +// }) +// console.log(ofAge) + +const ofAge = people.every(function(person) { + const currYear = (new Date()).getFullYear(); + return currYear-person.year >=19 +}) + +console.log(ofAge) // Some and Every Checks // Array.prototype.some() // is at least one person 19? // Array.prototype.every() // is everyone 19? @@ -32,6 +46,20 @@ // Find is like filter, but instead returns just the one you are looking for // find the comment with the ID of 823423 +const found = comments.find(function(message) { + return message.id === 823423 +}) + +console.log(found) + +const foundIndex = comments.findIndex(function(message) { + return message.id === 823423 + +}) + +comments.splice(foundIndex, 1) +console.log(comments) + // Array.prototype.findIndex() // Find the comment with this ID // delete the comment with the ID of 823423