Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion 04 - Array Cardio Day 1/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,25 @@ const de = links
*/



// 7. sort Exercise
// Sort the people alphabetically by last name
// const abc = people.sort(function(lastOne, nextOne) {
// const [aLast, aFirst] = lastOne.split(', ');
// const [bLast, bFirst] = nextOne.split(', ');
// // console.log(last, first);
// return aLast > bLast ? -1 : 1;
// });
/********************************************************
* ️️️☝️ Turns Proper Function into an Arrow Function ☝️
********************************************************/
const abc = people.sort((lastOne, nextOne) => {
const [aLast, aFirst] = lastOne.split(', ');
const [bLast, bFirst] = nextOne.split(', ');
// console.log(last, first);
return aLast > bLast ? -1 : 1;
});
console.log(abc);


// 8. Reduce Exercise
// Sum up the instances of each of these
Expand Down