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 142142
143143 // 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name
144144 // 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"));
150150
151- console . log ( deStreetNames ) ;
151+ // console.log(deStreetNames);
152152
153153 // 7. sort Exercise
154154 // 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 ) ;
155161
156162 // 8. Reduce Exercise
157163 // Sum up the instances of each of these
You can’t perform that action at this time.
0 commit comments