diff --git a/01 - JavaScript Drum Kit/img/drummer.jpg b/01 - JavaScript Drum Kit/img/drummer.jpg new file mode 100644 index 0000000000..da69d99c13 Binary files /dev/null and b/01 - JavaScript Drum Kit/img/drummer.jpg differ diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html deleted file mode 100644 index 4070d32767..0000000000 --- a/01 - JavaScript Drum Kit/index-START.html +++ /dev/null @@ -1,66 +0,0 @@ - - -
- -Psst: have a look at the JavaScript Console ๐
- - - diff --git a/04 - Array Cardio Day 1/index-FINISHED.html b/04 - Array Cardio Day 1/index.html similarity index 66% rename from 04 - Array Cardio Day 1/index-FINISHED.html rename to 04 - Array Cardio Day 1/index.html index ede883f1f9..8b0614d501 100644 --- a/04 - Array Cardio Day 1/index-FINISHED.html +++ b/04 - Array Cardio Day 1/index.html @@ -27,79 +27,90 @@ { first: 'Hanna', last: 'Hammarstrรถm', year: 1829, passed: 1909 } ]; - 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']; + 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)); + const fifteen = inventors.filter(item => { + return item.year >= 1500 && item.year < 1600; + }); console.table(fifteen); // 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 inventors' first and last names + + const names = inventors.map(item => { + return { first: item.first, last: item.last } + }); + + console.table(names); // 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); + const sorted = inventors.sort((a, b) => { + return 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); + + const yearsTotal = inventors.reduce((total, item) => { + return total + (item.passed - item.year); }, 0); - console.log(totalYears); + console.log('total', yearsTotal); // 5. Sort the inventors by years lived - const oldest = inventors.sort(function(a, b) { - const lastInventor = a.passed - a.year; - const nextInventor = b.passed - b.year; - return lastInventor > nextInventor ? -1 : 1; + + const sortedByYearsLived = inventors.sort((a,b) => { + const ageA = a.passed - a.year; + const ageB = b.passed - b.year; + return ageA > ageB ? -1 : 1; }); - console.table(oldest); + + console.table(sortedByYearsLived); // 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); + + const sortedByLastName = people.map(name => { + const nameParts = name.split(', '); + return { fullName: name, last: nameParts[0], first: nameParts[1] } + }).sort((a,b) => { + return a.last > b.last ? 1 : -1; + }).map(person => person.fullName); + + console.log(sortedByLastName); + // 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; + const data = ['car', 'car', 'truck', 'truck', 'bike', 'walk', 'car', 'van', 'bike', 'walk', 'car', 'van', 'car', 'truck' ]; + + const sumTypes = data.reduce((sum, next) => { + if(!sum[next]) { + sum[next] = 1; + } else { + sum[next]++; } - obj[item]++; - return obj; + return sum; }, {}); - - console.log(transportation); + + console.log(sumTypes); diff --git a/05 - Flex Panel Gallery/index-START.html b/05 - Flex Panel Gallery/index-START.html deleted file mode 100644 index e1d643ad5c..0000000000 --- a/05 - Flex Panel Gallery/index-START.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - -Hey
-Let's
-Dance
-Give
-Take
-Receive
-Experience
-It
-Today
-Give
-All
-You can
-Life
-In
-Motion
-