Skip to content

Commit 1ec5c17

Browse files
committed
Merge branch 'master' of github.com:wesbos/JavaScript30
2 parents c99d471 + 45e08db commit 1ec5c17

11 files changed

Lines changed: 28 additions & 49 deletions

File tree

03 - CSS Variables/index-FINISHED.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ <h2>Update CSS Variables with <span class='hl'>JS</span></h2>
5757
margin-bottom: 50px;
5858
}
5959

60-
a {
61-
color: var(--base);
62-
text-decoration: none;
63-
}
64-
6560
input {
6661
width:100px;
6762
}

03 - CSS Variables/index-START.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ <h2>Update CSS Variables with <span class='hl'>JS</span></h2>
4242
margin-bottom: 50px;
4343
}
4444

45-
a {
46-
color: var(--base);
47-
text-decoration: none;
48-
}
49-
5045
input {
5146
width:100px;
5247
}

04 - Array Cardio Day 1/index-FINISHED.html

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<title>Array Cardio 💪</title>
66
</head>
77
<body>
8+
<p><em>Psst: have a look at the JavaScript Console</em> 💁</p>
89
<script>
910
// Get your shorts on - this is an array workout!
1011
// ## Array Cardio Day 1
@@ -19,6 +20,11 @@
1920
{ first: 'Johannes', last: 'Kepler', year: 1571, passed: 1630 },
2021
{ first: 'Nicolaus', last: 'Copernicus', year: 1473, passed: 1543 },
2122
{ first: 'Max', last: 'Planck', year: 1858, passed: 1947 },
23+
{ first: 'Katherine', last: 'Blodgett', year: 1898, passed: 1979 },
24+
{ first: 'Ada', last: 'Lovelace', year: 1815, passed: 1852 },
25+
{ first: 'Sarah E.', last: 'Goode', year: 1855, passed: 1905 },
26+
{ first: 'Lise', last: 'Meitner', year: 1878, passed: 1968 },
27+
{ first: 'Hanna', last: 'Hammarström', year: 1829, passed: 1909 }
2228
];
2329

2430
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'];
@@ -57,9 +63,9 @@
5763

5864
// 5. Sort the inventors by years lived
5965
const oldest = inventors.sort(function(a, b) {
60-
const lastGuy = a.passed - a.year;
61-
const nextGuy = b.passed - b.year;
62-
return lastGuy > nextGuy ? -1 : 1;
66+
const lastInventor = a.passed - a.year;
67+
const nextInventor = b.passed - b.year;
68+
return lastInventor > nextInventor ? -1 : 1;
6369
});
6470
console.table(oldest);
6571

@@ -75,8 +81,8 @@
7581
// 7. sort Exercise
7682
// Sort the people alphabetically by last name
7783
const alpha = people.sort((lastOne, nextOne) => {
78-
const [aLast, aFirst] = lastOne.split(', ');
79-
const [bLast, bFirst] = nextOne.split(', ');
84+
const [aFirst, aLast] = lastOne.split(', ');
85+
const [bFirst, bLast] = nextOne.split(', ');
8086
return aLast > bLast ? 1 : -1;
8187
});
8288
console.log(alpha);

04 - Array Cardio Day 1/index-START.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<title>Array Cardio 💪</title>
66
</head>
77
<body>
8+
<p><em>Psst: have a look at the JavaScript Console</em> 💁</p>
89
<script>
910
// Get your shorts on - this is an array workout!
1011
// ## Array Cardio Day 1
@@ -18,7 +19,12 @@
1819
{ first: 'Marie', last: 'Curie', year: 1867, passed: 1934 },
1920
{ first: 'Johannes', last: 'Kepler', year: 1571, passed: 1630 },
2021
{ first: 'Nicolaus', last: 'Copernicus', year: 1473, passed: 1543 },
21-
{ first: 'Max', last: 'Planck', year: 1858, passed: 1947 }
22+
{ first: 'Max', last: 'Planck', year: 1858, passed: 1947 },
23+
{ first: 'Katherine', last: 'Blodgett', year: 1898, passed: 1979 },
24+
{ first: 'Ada', last: 'Lovelace', year: 1815, passed: 1852 },
25+
{ first: 'Sarah E.', last: 'Goode', year: 1855, passed: 1905 },
26+
{ first: 'Lise', last: 'Meitner', year: 1878, passed: 1968 },
27+
{ first: 'Hanna', last: 'Hammarström', year: 1829, passed: 1909 }
2228
];
2329

2430
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'];
@@ -29,7 +35,7 @@
2935
// 1. Filter the list of inventors for those who were born in the 1500's
3036

3137
// Array.prototype.map()
32-
// 2. Give us an array of the inventory first and last names
38+
// 2. Give us an array of the inventors' first and last names
3339

3440
// Array.prototype.sort()
3541
// 3. Sort the inventors by birthdate, oldest to youngest

07 - Array Cardio Day 2/index-FINISHED.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8">
5-
<title>Document</title>
5+
<title>Array Cardio 💪💪</title>
66
</head>
77
<body>
8+
<p><em>Psst: have a look at the JavaScript Console</em> 💁</p>
89
<script>
910
// ## Array Cardio Day 2
1011

@@ -19,7 +20,7 @@
1920
{ text: 'Love this!', id: 523423 },
2021
{ text: 'Super good', id: 823423 },
2122
{ text: 'You are the best', id: 2039842 },
22-
{ text: 'Ramen in my fav food ever', id: 123523 },
23+
{ text: 'Ramen is my fav food ever', id: 123523 },
2324
{ text: 'Nice Nice Nice!', id: 542328 }
2425
];
2526

07 - Array Cardio Day 2/index-START.html

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8">
5-
<title>Document</title>
5+
<title>Array Cardio 💪💪</title>
66
</head>
77
<body>
8+
<p><em>Psst: have a look at the JavaScript Console</em> 💁</p>
89
<script>
910
// ## Array Cardio Day 2
1011

@@ -19,48 +20,21 @@
1920
{ text: 'Love this!', id: 523423 },
2021
{ text: 'Super good', id: 823423 },
2122
{ text: 'You are the best', id: 2039842 },
22-
{ text: 'Ramen in my fav food ever', id: 123523 },
23+
{ text: 'Ramen is my fav food ever', id: 123523 },
2324
{ text: 'Nice Nice Nice!', id: 542328 }
2425
];
2526

2627
// Some and Every Checks
2728
// Array.prototype.some() // is at least one person 19?
28-
// const isAdult = people.some(function(person) {
29-
// const currentYear = (new Date()).getFullYear();
30-
// if(currentYear - person.year >= 19) {
31-
// return true;
32-
// }
33-
// });
34-
35-
const isAdult = people.some(person => ((new Date()).getFullYear()) - person.year >= 19);
36-
37-
console.log({isAdult});
3829
// Array.prototype.every() // is everyone 19?
3930

40-
const allAdults = people.every(person => ((new Date()).getFullYear()) - person.year >= 19);
41-
console.log({allAdults});
42-
4331
// Array.prototype.find()
4432
// Find is like filter, but instead returns just the one you are looking for
4533
// find the comment with the ID of 823423
4634

47-
48-
const comment = comments.find(comment => comment.id === 823423);
49-
50-
console.log(comment);
51-
5235
// Array.prototype.findIndex()
5336
// Find the comment with this ID
5437
// delete the comment with the ID of 823423
55-
const index = comments.findIndex(comment => comment.id === 823423);
56-
console.log(index);
57-
58-
// comments.splice(index, 1);
59-
60-
const newComments = [
61-
...comments.slice(0, index),
62-
...comments.slice(index + 1)
63-
];
6438

6539
</script>
6640
</body>

0 commit comments

Comments
 (0)