diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..2275b43 Binary files /dev/null and b/.DS_Store differ diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index c771dea..81ffe17 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -59,6 +59,25 @@ diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 2712384..6fe3f79 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -61,12 +61,41 @@ background:black; position: absolute; top:50%; + transform-origin: 100% 50%; + transition: all 1s; } - + diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index 7171607..d31aeaa 100644 --- a/03 - CSS Variables/index-START.html +++ b/03 - CSS Variables/index-START.html @@ -9,19 +9,23 @@

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 4162bce..3e86b19 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -33,29 +33,87 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + console.table( + inventors.filter(el => { + return el.year > 1500 && el.year < 1600 + }) + ) // Array.prototype.map() // 2. Give us an array of the inventors' first and last names + console.table( + inventors.map(el => { + return el.first + ' ' + el.last + }) + ) // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + console.table( + inventors.sort((a, b) => { + return a.year - b.year + }) + ) // Array.prototype.reduce() // 4. How many years did all the inventors live? + console.log( + inventors.reduce((acum, currentValue) => { + let num = currentValue.passed - currentValue.year + return acum += num + }, 0) + ) // 5. Sort the inventors by years lived + console.table( + inventors.sort((fst, secnd) => { + let fstYear = fst.passed - fst.year + let secndYear = secnd.passed - secnd.year + return secndYear > fstYear ? 1 : -1 + }) + ) // 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name // https://en.wikipedia.org/wiki/Category:Boulevards_in_Paris - + // 7. sort Exercise // Sort the people alphabetically by last name + console.log( + people.map(el => { return { first:el.split(' ')[0], last:el.split(' ')[1]} }) + .sort((a, b) => { + if (a.last < b.last) { + return -1; + } + if (a.last > b.last) { + return 1; + } + // names must be equal + return 0; + }) + .map(el => {return el.first + ' ' + el.last}) + ) + + // const alpha = people.sort((lastOne, nextOne) => { + // const [aFirst, aLast] = lastOne.split(', '); + // const [bFirst, bLast] = nextOne.split(', '); + // return aLast > bLast ? 1 : -1; + // }); + // console.log(alpha); + // 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' ]; - + console.log( + data.reduce((obj, current) => { + if(!obj[current]){ + obj[current] = 0 + } + obj[current] = obj[current] + 1 + return obj + }, {}) + ) diff --git a/05 - Flex Panel Gallery/index-FINISHED.html b/05 - Flex Panel Gallery/index-FINISHED.html index 243f8a2..6d6fa70 100644 --- a/05 - Flex Panel Gallery/index-FINISHED.html +++ b/05 - Flex Panel Gallery/index-FINISHED.html @@ -126,12 +126,13 @@ const panels = document.querySelectorAll('.panel'); function toggleOpen() { - console.log('Hello'); + console.log('老媽,快打開'); this.classList.toggle('open'); } function toggleActive(e) { - console.log(e.propertyName); + console.log('媽呀!end了') + // console.log(e.propertyName); if (e.propertyName.includes('flex')) { this.classList.toggle('open-active'); } diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html index 04e974b..261707b 100644 --- a/05 - Flex Panel Gallery/index-START.html +++ b/05 - Flex Panel Gallery/index-START.html @@ -24,6 +24,9 @@ .panels { min-height:100vh; overflow: hidden; + + display:flex; + justify-content: center; } .panel { @@ -41,6 +44,11 @@ font-size: 20px; background-size:cover; background-position:center; + + flex-grow: 1; + display: flex; + flex-direction: column; + justify-content: space-between; } @@ -62,12 +70,26 @@ text-shadow:0 0 4px rgba(0, 0, 0, 0.72), 0 0 14px rgba(0, 0, 0, 0.45); font-size: 2em; } + + .panel p:nth-child(1) { + transform: translateY(-100%) + } + .panel p:nth-child(2) { font-size: 4em; } + .panel p:nth-child(3) { + transform: translateY(100%) + } + + .panel.open-active p:nth-child(1), .panel.open-active p:nth-child(3){ + transform: translateY(0) + } + .panel.open { font-size:40px; + flex: 6; } .cta { @@ -107,7 +129,38 @@ diff --git a/06 - Type Ahead/index-START.html b/06 - Type Ahead/index-START.html index 1436886..3c44c21 100644 --- a/06 - Type Ahead/index-START.html +++ b/06 - Type Ahead/index-START.html @@ -15,7 +15,99 @@ diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 206ec31..a2ecfe3 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -27,15 +27,35 @@ // Some and Every Checks // Array.prototype.some() // is at least one person 19? // Array.prototype.every() // is everyone 19? - + let someData = people.some((currentValue, index, array) => { + return new Date().getFullYear() - currentValue.year > 19 + }) + console.log({isAdult: someData}) + let everydata = people.every((currentValue, index, array) => { + return new Date().getFullYear() - currentValue.year > 19 + }) + console.log({isAllAdult: everydata}) // 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 item = comments.find((el) => { + return el.id === 823423 + }) + console.log(item) // Array.prototype.findIndex() // Find the comment with this ID // delete the comment with the ID of 823423 + // comments.splice(comments.findIndex((el) => el.id === 823423), 1) + + let index = comments.findIndex(el => el.id === 823423) + const newComments = [ + ...comments.slice(0, index), + ...comments.slice(index+1) + ] + console.log(newComments) + diff --git a/08 - Fun with HTML5 Canvas/index-START.html b/08 - Fun with HTML5 Canvas/index-START.html index 37c148d..fa7ad56 100644 --- a/08 - Fun with HTML5 Canvas/index-START.html +++ b/08 - Fun with HTML5 Canvas/index-START.html @@ -5,14 +5,121 @@ HTML5 Canvas - + + + + +