Skip to content

Commit 7c383d6

Browse files
authored
7. sort Exercise make it so it sorts on last name
In your video you still sort on the first name of the array but you called it `aLast` and `bLast` but they where in the first position of the array like this: `const [aLast, aFirst]` when changed to `const [aFirst, aLast]` it will filter on the second part of the array. There for it will sort on the last name. To bad there is no way to pull request your video.
1 parent 38a754c commit 7c383d6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
// 7. sort Exercise
7676
// Sort the people alphabetically by last name
7777
const alpha = people.sort((lastOne, nextOne) => {
78-
const [aLast, aFirst] = lastOne.split(', ');
79-
const [bLast, bFirst] = nextOne.split(', ');
78+
const [aFirst, aLast] = lastOne.split(', ');
79+
const [bFirst, bLast] = nextOne.split(', ');
8080
return aLast > bLast ? 1 : -1;
8181
});
8282
console.log(alpha);

0 commit comments

Comments
 (0)