File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 142
142
143
143
// 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name
144
144
// https://en.wikipedia.org/wiki/Category:Boulevards_in_Paris
145
- const category = document . querySelector ( ".mw-category" ) ;
146
- const links = Array . from ( category . querySelectorAll ( "a" ) ) ;
147
- const deStreetNames = links
148
- . map ( ( link ) => link . textContent )
149
- . filter ( ( street ) => street . includes ( " de" ) ) ;
145
+ // const category = document.querySelector(".mw-category");
146
+ // const links = Array.from(category.querySelectorAll("a"));
147
+ // const deStreetNames = links
148
+ // .map((link) => link.textContent)
149
+ // .filter((street) => street.includes(" de"));
150
150
151
- console . log ( deStreetNames ) ;
151
+ // console.log(deStreetNames);
152
152
153
153
// 7. sort Exercise
154
154
// Sort the people alphabetically by last name
155
+ const alphaSort = people . sort ( ( a , b ) => {
156
+ const [ aLast , aFirst ] = a . split ( ", " ) ;
157
+ const [ bLast , bFirst ] = b . split ( ", " ) ;
158
+ return aFirst > bFirst ? 1 : - 1 ;
159
+ } ) ;
160
+ console . log ( alphaSort ) ;
155
161
156
162
// 8. Reduce Exercise
157
163
// Sum up the instances of each of these
You can’t perform that action at this time.
0 commit comments