Find the longest and shortest words in a list, sorting them by the number of letters that they contain. You can sort in ascending or descending order.
export const take = [
{ type: "list", label: "Words" },
{ type: "toggle", label: "Sort ascending" },
]
export const make = ([list, asc]) => ({
type: "list",
label: "Sorted by length",
value: list.sort((a, b) => (asc ? 1 : -1) * (a.length - b.length)),
})