/**
* @function 数组排列组合
* [1,2,3] => 123 132 213 231 321 312
*/
function permutationCombination(arr) {if (arr.length === 1) {return [arr];
}
const res = [];
arr.forEach((val, index) => {const childArr = [...arr];
childArr.splice(index, 1);
res.push(...permutationCombination(childArr).map(item => [val, ...item])
);
});
return res;
}