Skip to content

Commit caa07a0

Browse files
committed
04 - Array Cardio Day 1: Answer wesbos#7
1 parent c1adeee commit caa07a0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@
7777

7878
// 7. sort Exercise
7979
// Sort the people alphabetically by last name
80+
const alpha = people.sort((a, b) => {
81+
const [lastA] = a.split(', ')
82+
const [lastB] = b.split(', ')
83+
84+
return lastA > lastB ? 1 : -1
85+
})
86+
console.log(alpha)
8087

8188
// 8. Reduce Exercise
8289
// Sum up the instances of each of these

0 commit comments

Comments
 (0)