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.
Nothing to see yet!
({ take: [ { type: "list", label: "Words" }, { type: "toggle", label: "Sort ascending" }, ], make: ([list, asc]) => ({ type: "list", label: "Sorted by length", value: list.sort((a, b) => (asc ? 1 : -1) * (a.length - b.length)), }), })