nhoizey’s avatarnhoizey’s Twitter Archive—№ 115,458

  1. With JavaScript, how would you compute all sorted permutations of 1 to n elements from a given array? For example, with this source [1, 2, 3] and n=2 How would you get this? javascript [[1], [2], [3], [1, 2], [1, 3], [2, 3]]; nicolas-hoizey.com/notes/2022/04/25/1/