diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..ad91c76725 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -58,6 +58,23 @@ diff --git a/02 - JS + CSS Clock/index-START.html b/02 - JS + CSS Clock/index-START.html index 2712384201..826755e396 100644 --- a/02 - JS + CSS Clock/index-START.html +++ b/02 - JS + CSS Clock/index-START.html @@ -61,12 +61,30 @@ background:black; position: absolute; top:50%; + transform-origin: 100%; + transition: all .05s; + transition-timing-function: cubic-bezier(.1 2.7 .58 1); } diff --git a/03 - CSS Variables/index-START.html b/03 - CSS Variables/index-START.html index 7171607a8b..d9c90c3245 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..07bf906ac0 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -33,28 +33,48 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + const fifteen = inventors.filter(inv => Math.floor(inv.year / 100) === 15); + // console.table(fifteen); // Array.prototype.map() // 2. Give us an array of the inventors' first and last names + const first = inventors.map(inv => inv.first + ' ' + inv.last); + // console.log(first); // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest + const youngest = inventors.sort((a,b) => a.year > b.year ? 1 : -1); + // console.table(youngest); // Array.prototype.reduce() // 4. How many years did all the inventors live? + const totLife = inventors.reduce((total, inv) => total + inv.passed - inv.year, 0); + // console.log(totLife); // 5. Sort the inventors by years lived + const age = inventors.sort((a,b) => a.passed - a.year < b.passed - b.year ? 1 : -1); + // console.table(age); // 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 streets = [...document.querySelectorAll('.mw-category a')] + .map(el => el.innerText) + .filter(name => name.includes('de')); // 7. sort Exercise // Sort the people alphabetically by last name + const last = people.sort((a,b) => a.split(',')[0] > b.split(',')[0] ? 1 : -1); + // console.log(last); // 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 trans = data.reduce((obj, item) => { + obj[item] ? obj[item]++ : obj[item] = 1; + return obj; + }, {}); + console.log(trans);