From 1ea5f63c456d02e6fb320437183cb3f4de5849c1 Mon Sep 17 00:00:00 2001 From: no3x Date: Sun, 11 Dec 2016 14:57:34 +0000 Subject: [PATCH 1/3] Completed 01 --- 01 - JavaScript Drum Kit/index-FINISHED.html | 25 ++++++++++---------- 01 - JavaScript Drum Kit/style.css | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/01 - JavaScript Drum Kit/index-FINISHED.html b/01 - JavaScript Drum Kit/index-FINISHED.html index 1a16d0997c..74862eeae1 100644 --- a/01 - JavaScript Drum Kit/index-FINISHED.html +++ b/01 - JavaScript Drum Kit/index-FINISHED.html @@ -58,23 +58,24 @@ diff --git a/01 - JavaScript Drum Kit/style.css b/01 - JavaScript Drum Kit/style.css index 3e0a320b37..2d1e7ec670 100644 --- a/01 - JavaScript Drum Kit/style.css +++ b/01 - JavaScript Drum Kit/style.css @@ -1,6 +1,6 @@ html { font-size: 10px; - background:url(http://i.imgur.com/b9r5sEL.jpg) bottom center; + background:url(https://i.imgur.com/b9r5sEL.jpg) bottom center; background-size: cover; } body,html { From 977a09fa535874b1e40152e4ada0c379ea39b650 Mon Sep 17 00:00:00 2001 From: no3x Date: Wed, 14 Dec 2016 22:05:56 +0000 Subject: [PATCH 2/3] Completed 2 --- 02 - JS + CSS Clock/index-FINISHED.html | 37 ++++++++++++------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/02 - JS + CSS Clock/index-FINISHED.html b/02 - JS + CSS Clock/index-FINISHED.html index d4cb3b56a8..1495e879ad 100644 --- a/02 - JS + CSS Clock/index-FINISHED.html +++ b/02 - JS + CSS Clock/index-FINISHED.html @@ -69,30 +69,29 @@ From 1ddb9d0b1fb5042aadad26fcd087c2f4c6b2d761 Mon Sep 17 00:00:00 2001 From: no3x Date: Sat, 18 Feb 2017 17:07:34 +0000 Subject: [PATCH 3/3] Completed 03 --- 03 - CSS Variables/index-FINISHED.html | 19 ++--- 04 - Array Cardio Day 1/index-FINISHED.html | 84 ++++++++------------- 2 files changed, 41 insertions(+), 62 deletions(-) diff --git a/03 - CSS Variables/index-FINISHED.html b/03 - CSS Variables/index-FINISHED.html index 9401d7b339..9591caffef 100644 --- a/03 - CSS Variables/index-FINISHED.html +++ b/03 - CSS Variables/index-FINISHED.html @@ -68,15 +68,16 @@

Update CSS Variables with JS

diff --git a/04 - Array Cardio Day 1/index-FINISHED.html b/04 - Array Cardio Day 1/index-FINISHED.html index f68d8c3545..25146a7be9 100644 --- a/04 - Array Cardio Day 1/index-FINISHED.html +++ b/04 - Array Cardio Day 1/index-FINISHED.html @@ -18,82 +18,60 @@ { first: 'Marie', last: 'Curie', year: 1867, passed: 1934 }, { first: 'Johannes', last: 'Kepler', year: 1571, passed: 1630 }, { first: 'Nicolaus', last: 'Copernicus', year: 1473, passed: 1543 }, - { first: 'Max', last: 'Planck', year: 1858, passed: 1947 }, + { first: 'Max', last: 'Planck', year: 1858, passed: 1947 } ]; + const flavours = ['Chocolate Chip', 'Kulfi', 'Caramel Praline', 'Chocolate', 'Burnt Caramel', 'Pistachio', 'Rose', 'Sweet Coconut', 'Lemon Cookie', 'Toffeeness', 'Toasted Almond', 'Black Raspberry Crunch', 'Chocolate Brownies', 'Pistachio Almond', 'Strawberry', 'Lavender Honey', 'Lychee', 'Peach', 'Black Walnut', 'Birthday Cake', 'Mexican Chocolate', 'Mocha Almond Fudge', 'Raspberry']; + const people = ['Beck, Glenn', 'Becker, Carl', 'Beckett, Samuel', 'Beddoes, Mick', 'Beecher, Henry', 'Beethoven, Ludwig', 'Begin, Menachem', 'Belloc, Hilaire', 'Bellow, Saul', 'Benchley, Robert', 'Benenson, Peter', 'Ben-Gurion, David', 'Benjamin, Walter', 'Benn, Tony', 'Bennington, Chester', 'Benson, Leana', 'Bent, Silas', 'Bentsen, Lloyd', 'Berger, Ric', 'Bergman, Ingmar', 'Berio, Luciano', 'Berle, Milton', 'Berlin, Irving', 'Berne, Eric', 'Bernhard, Sandra', 'Berra, Yogi', 'Berry, Halle', 'Berry, Wendell', 'Bethea, Erin', 'Bevan, Aneurin', 'Bevel, Ken', 'Biden, Joseph', 'Bierce, Ambrose', 'Biko, Steve', 'Billings, Josh', 'Biondo, Frank', 'Birrell, Augustine', 'Black Elk', 'Blair, Robert', 'Blair, Tony', 'Blake, William']; // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's - const fifteen = inventors.filter(inventor => (inventor.year >= 1500 && inventor.year < 1600)); - - console.table(fifteen); - + var filtered = inventors.filter( function(inventor) { + return inventor.year >= 1500 && inventor.year < 1600; + }); + console.log(filtered); // Array.prototype.map() - // 2. Give us an array of the inventor first and last names - const fullNames = inventors.map(inventor => `${inventor.first} ${inventor.last}`); - console.log(fullNames); + // 2. Give us an array of the inventory first and last names + var mapped = inventors.map( inventor => `${inventor.first} ${inventor.last}`); + console.log(mapped); // Array.prototype.sort() // 3. Sort the inventors by birthdate, oldest to youngest - // const ordered = inventors.sort(function(a, b) { - // if(a.year > b.year) { - // return 1; - // } else { - // return -1; - // } - // }); - - const ordered = inventors.sort((a, b) => a.year > b.year ? 1 : -1); - console.table(ordered); - + var 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 totalYears = inventors.reduce((total, inventor) => { - return total + (inventor.passed - inventor.year); - }, 0); - - console.log(totalYears); + var lives = inventors.reduce( (acc, inventor) => { return acc += (inventor.passed - inventor.year)}, 0 ); + console.log(lives); // 5. Sort the inventors by years lived - const oldest = inventors.sort(function(a, b) { - const lastGuy = a.passed - a.year; - const nextGuy = b.passed - b.year; - return lastGuy > nextGuy ? -1 : 1; + var sortedByAgesLived = inventors.sort( (a,b) => { + a.lived = a.passed - a.year; + return ( a.passed - a.year > b.passed - b.year ) ? 1 : -1; }); - console.table(oldest); + console.table(sortedByAgesLived); // 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 de = links - // .map(link => link.textContent) - // .filter(streetName => streetName.includes('de')); - // 7. sort Exercise // Sort the people alphabetically by last name - const alpha = people.sort((lastOne, nextOne) => { - const [aLast, aFirst] = lastOne.split(', '); - const [bLast, bFirst] = nextOne.split(', '); - return aLast > bLast ? 1 : -1; - }); - console.log(alpha); - + var sortedPeople = people.sort( (a,b) => { + const [aLast, aFirst] = a.split(","); + const [bLast, bFirst] = b.split(","); + return aLast > bLast ? 1 : -1; + }); + console.table(sortedPeople); + // 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', 'pogostick']; - - const transportation = data.reduce(function(obj, item) { - if (!obj[item]) { - obj[item] = 0; - } - obj[item]++; - return obj; - }, {}); - - console.log(transportation); + const data = ['car', 'car', 'truck', 'truck', 'bike', 'walk', 'car', 'van', 'bike', 'walk', 'car', 'van', 'car', 'truck' ]; + const instances = data.reduce( (acc, inst) => { + acc[inst] = (!acc[inst] ? 0 : acc[inst]) + 1; + return acc; + }, []); + console.table(instances);