Skip to content

Commit 1af1725

Browse files
committed
solved wesbos#7 with little assistance
1 parent 9c5ccf2 commit 1af1725

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,28 @@
7373
// 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name
7474
// https://en.wikipedia.org/wiki/Category:Boulevards_in_Paris
7575

76-
const category = document.querySelector(".mw-category-columns");
76+
/*const category = document.querySelector(".mw-category-columns");
7777
const links = Array.from(category.querySelectorAll("a"));
7878
const de = links
7979
.map(anchor => anchor.textContent)
8080
.filter(streetName => streetName.includes("de"));
8181
8282
83-
console.log(de);
83+
console.log(de);*/
8484

8585

8686
// 7. sort Exercise
8787
// Sort the people alphabetically by last name
8888

89+
const alphabetical = people.sort((firstPerson, nextPerson) => {
90+
let [lastA, firstA] = firstPerson.split(", ");;
91+
let [lastB, firstB] = nextPerson.split(", ");
92+
return lastA > lastB ? 1: -1;
93+
94+
});
95+
console.table(alphabetical);
96+
97+
8998
// 8. Reduce Exercise
9099
// Sum up the instances of each of these
91100
const data = ['car', 'car', 'truck', 'truck', 'bike', 'walk', 'car', 'van', 'bike', 'walk', 'car', 'van', 'car', 'truck' ];

0 commit comments

Comments
 (0)