File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 6868
6969 // 6. create a list of Boulevards in Paris that contain 'de' anywhere in the name
7070 // https://en.wikipedia.org/wiki/Category:Boulevards_in_Paris
71- const category = document . querySelector ( '.mw-category' ) ;
72- const links = Array . from ( category . querySelectorAll ( 'a' ) ) ;
73- const de = links
74- . map ( link => link . textContent )
75- . filter ( streetName => streetName . includes ( 'de' ) ) ;
71+ // const category = document.querySelector('.mw-category');
72+ // const links = Array.from(category.querySelectorAll('a'));
73+ // const de = links
74+ // .map(link => link.textContent)
75+ // .filter(streetName => streetName.includes('de'));
7676
7777 // 7. sort Exercise
7878 // Sort the people alphabetically by last name
79-
79+ const alpha = people . sort ( ( lastOne , nextOne ) => {
80+ const [ aLast , aFirst ] = lastOne . split ( ', ' ) ;
81+ const [ bLast , bFirst ] = nextOne . split ( ', ' ) ;
82+ return aLast > bLast ? 1 : - 1 ;
83+ } ) ;
84+ console . log ( alpha ) ;
8085
8186 // 8. Reduce Exercise
8287 // Sum up the instances of each of these
You can’t perform that action at this time.
0 commit comments