Sort lines by word length

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.

Face with waiting expression Nothing to see yet!

Loading takeymakey...
TakeyMakey code
Want this tool to do something else? Edit the code below and make it do whatever you want.
({
  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)),
  }),
})