[Solved] sort a list of lists by how many values each list has [duplicate]
Yes, you can use array sort method with a custom compare function. listOLists.sort((a, b) => a.length > b.length ? 1 : -1) If you want the order of same length item to be preserved you need to do the following, listOLists.sort((a, b) => a.length – b.length) Thanks to Patrick for pointing that out. For reference … Read more