순열 순서가 상관이 있기때문에, index (중심이 되는 숫자의 index)를 제외한 다른 부분들을 다음 배열에 넣어줌 const getPermutations = function (arr, selectNumber) { const results = []; if (selectNumber === 1) return arr.map((e) => [e]); arr.forEach((fixed, index) => { const next = [...arr.slice(0, index), ...arr.slice(index+1)] const permutations = getPermutations(next, selectNumber - 1); const result = permutations.map((e) => [fixed, ....