Skip to content

Commit dc93584

Browse files
sagun-macsagun-mac
authored andcommitted
Finished problem 1 created Object people born in 1500's
1 parent 7c04fd5 commit dc93584

File tree

1 file changed

+105
-52
lines changed

1 file changed

+105
-52
lines changed
Lines changed: 105 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,119 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="UTF-8">
5-
<title>Array Cardio 💪</title>
6-
<link rel="icon" href="https://fav.farm/🔥" />
7-
</head>
8-
<body>
9-
<p><em>Psst: have a look at the JavaScript Console</em> 💁</p>
10-
<script>
11-
// Get your shorts on - this is an array workout!
12-
// ## Array Cardio Day 1
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>Array Cardio 💪</title>
6+
<link rel="icon" href="https://fav.farm/🔥" />
7+
</head>
8+
<body>
9+
<p><em>Psst: have a look at the JavaScript Console</em> 💁</p>
10+
<script>
11+
// Get your shorts on - this is an array workout!
12+
// ## Array Cardio Day 1
1313

14-
// Some data we can work with
14+
// Some data we can work with
1515

16-
const inventors = [
17-
{ first: 'Albert', last: 'Einstein', year: 1879, passed: 1955 },
18-
{ first: 'Isaac', last: 'Newton', year: 1643, passed: 1727 },
19-
{ first: 'Galileo', last: 'Galilei', year: 1564, passed: 1642 },
20-
{ first: 'Marie', last: 'Curie', year: 1867, passed: 1934 },
21-
{ first: 'Johannes', last: 'Kepler', year: 1571, passed: 1630 },
22-
{ first: 'Nicolaus', last: 'Copernicus', year: 1473, passed: 1543 },
23-
{ first: 'Max', last: 'Planck', year: 1858, passed: 1947 },
24-
{ first: 'Katherine', last: 'Blodgett', year: 1898, passed: 1979 },
25-
{ first: 'Ada', last: 'Lovelace', year: 1815, passed: 1852 },
26-
{ first: 'Sarah E.', last: 'Goode', year: 1855, passed: 1905 },
27-
{ first: 'Lise', last: 'Meitner', year: 1878, passed: 1968 },
28-
{ first: 'Hanna', last: 'Hammarström', year: 1829, passed: 1909 }
29-
];
16+
const inventors = [
17+
{ first: "Albert", last: "Einstein", year: 1879, passed: 1955 },
18+
{ first: "Isaac", last: "Newton", year: 1643, passed: 1727 },
19+
{ first: "Galileo", last: "Galilei", year: 1564, passed: 1642 },
20+
{ first: "Marie", last: "Curie", year: 1867, passed: 1934 },
21+
{ first: "Johannes", last: "Kepler", year: 1571, passed: 1630 },
22+
{ first: "Nicolaus", last: "Copernicus", year: 1473, passed: 1543 },
23+
{ first: "Max", last: "Planck", year: 1858, passed: 1947 },
24+
{ first: "Katherine", last: "Blodgett", year: 1898, passed: 1979 },
25+
{ first: "Ada", last: "Lovelace", year: 1815, passed: 1852 },
26+
{ first: "Sarah E.", last: "Goode", year: 1855, passed: 1905 },
27+
{ first: "Lise", last: "Meitner", year: 1878, passed: 1968 },
28+
{ first: "Hanna", last: "Hammarström", year: 1829, passed: 1909 },
29+
];
3030

31-
const people = [
32-
'Bernhard, Sandra', 'Bethea, Erin', 'Becker, Carl', 'Bentsen, Lloyd', 'Beckett, Samuel', 'Blake, William', 'Berger, Ric', 'Beddoes, Mick', 'Beethoven, Ludwig',
33-
'Belloc, Hilaire', 'Begin, Menachem', 'Bellow, Saul', 'Benchley, Robert', 'Blair, Robert', 'Benenson, Peter', 'Benjamin, Walter', 'Berlin, Irving',
34-
'Benn, Tony', 'Benson, Leana', 'Bent, Silas', 'Berle, Milton', 'Berry, Halle', 'Biko, Steve', 'Beck, Glenn', 'Bergman, Ingmar', 'Black, Elk', 'Berio, Luciano',
35-
'Berne, Eric', 'Berra, Yogi', 'Berry, Wendell', 'Bevan, Aneurin', 'Ben-Gurion, David', 'Bevel, Ken', 'Biden, Joseph', 'Bennington, Chester', 'Bierce, Ambrose',
36-
'Billings, Josh', 'Birrell, Augustine', 'Blair, Tony', 'Beecher, Henry', 'Biondo, Frank'
37-
];
38-
39-
// Array.prototype.filter()
40-
// 1. Filter the list of inventors for those who were born in the 1500's
31+
const people = [
32+
"Bernhard, Sandra",
33+
"Bethea, Erin",
34+
"Becker, Carl",
35+
"Bentsen, Lloyd",
36+
"Beckett, Samuel",
37+
"Blake, William",
38+
"Berger, Ric",
39+
"Beddoes, Mick",
40+
"Beethoven, Ludwig",
41+
"Belloc, Hilaire",
42+
"Begin, Menachem",
43+
"Bellow, Saul",
44+
"Benchley, Robert",
45+
"Blair, Robert",
46+
"Benenson, Peter",
47+
"Benjamin, Walter",
48+
"Berlin, Irving",
49+
"Benn, Tony",
50+
"Benson, Leana",
51+
"Bent, Silas",
52+
"Berle, Milton",
53+
"Berry, Halle",
54+
"Biko, Steve",
55+
"Beck, Glenn",
56+
"Bergman, Ingmar",
57+
"Black, Elk",
58+
"Berio, Luciano",
59+
"Berne, Eric",
60+
"Berra, Yogi",
61+
"Berry, Wendell",
62+
"Bevan, Aneurin",
63+
"Ben-Gurion, David",
64+
"Bevel, Ken",
65+
"Biden, Joseph",
66+
"Bennington, Chester",
67+
"Bierce, Ambrose",
68+
"Billings, Josh",
69+
"Birrell, Augustine",
70+
"Blair, Tony",
71+
"Beecher, Henry",
72+
"Biondo, Frank",
73+
];
4174

42-
// Array.prototype.map()
43-
// 2. Give us an array of the inventors first and last names
75+
// Array.prototype.filter()
76+
// 1. Filter the list of inventors for those who were born in the 1500's
77+
const filteredObj = inventors.filter(
78+
(inventor) => inventor.year >= 1500 && inventor.year <= 1600
79+
);
80+
console.table(filteredObj);
4481

45-
// Array.prototype.sort()
46-
// 3. Sort the inventors by birthdate, oldest to youngest
82+
// Array.prototype.map()
83+
// 2. Give us an array of the inventors first and last names
4784

48-
// Array.prototype.reduce()
49-
// 4. How many years did all the inventors live all together?
85+
// Array.prototype.sort()
86+
// 3. Sort the inventors by birthdate, oldest to youngest
5087

51-
// 5. Sort the inventors by years lived
88+
// Array.prototype.reduce()
89+
// 4. How many years did all the inventors live all together?
5290

53-
// 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name
54-
// https://en.wikipedia.org/wiki/Category:Boulevards_in_Paris
91+
// 5. Sort the inventors by years lived
5592

93+
// 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name
94+
// https://en.wikipedia.org/wiki/Category:Boulevards_in_Paris
5695

57-
// 7. sort Exercise
58-
// Sort the people alphabetically by last name
96+
// 7. sort Exercise
97+
// Sort the people alphabetically by last name
5998

60-
// 8. Reduce Exercise
61-
// Sum up the instances of each of these
62-
const data = ['car', 'car', 'truck', 'truck', 'bike', 'walk', 'car', 'van', 'bike', 'walk', 'car', 'van', 'car', 'truck' ];
63-
64-
</script>
65-
</body>
99+
// 8. Reduce Exercise
100+
// Sum up the instances of each of these
101+
const data = [
102+
"car",
103+
"car",
104+
"truck",
105+
"truck",
106+
"bike",
107+
"walk",
108+
"car",
109+
"van",
110+
"bike",
111+
"walk",
112+
"car",
113+
"van",
114+
"car",
115+
"truck",
116+
];
117+
</script>
118+
</body>
66119
</html>

0 commit comments

Comments
 (0)