@rvoh/dream
    Preparing search index...

    Function sortBy

    Returns a copy of the array, sorted by the value returned by calling the function in the second argument on each element in the array.

    Examples: sortBy(['aaa', 'a', 'aa'], str => str.length) // ['a', 'aa', 'aaa'] sortBy(['aaa', 'a', 'aa'], str => -str.length) // ['aaa', 'aa', 'a'] sortBy([5, 3, 7], num => num) // [3, 5, 7] sortBy([5, 3, 7], num => -num) // [7, 5, 3] sortBy([bigint1, bigint2], x => x) // sorted bigints sortBy([obj1, obj2], obj => obj.prop) // sorted by property

    The array to sort

    Function returning the value to sort by

    A new sorted array