Chapter 6: functions

Sum all numbers till the given one

Sort by Field

given an array of objects to sort, sort them by field name using a else verbose function that looks like this:

Array.sort(byField(fieldname))

Instead of doing it the normal way with a function definition passed as an argument

Array.sort(users.sort((a, b) => (
    a.name > b.name ? 1: -1
    )
))