标签:for let lse 排列 get col cti lis array
//组合排列
let array = [‘1‘,‘2‘,‘3‘] function getGroup(data, index = 0, group = []) { let need_apply = []; need_apply.push(data[index]); for (var i = 0; i < group.length; i++) { need_apply.push(group[i] + ‘ ‘ + data[index]); } group.push.apply(group, need_apply); if (index + 1 >= data.length) return group; else return getGroup(data, index + 1, group); }
//排序 let list = getGroup(array).sort((a,b)=>{ if (a.length < b.length ) { return 1 } if (a.length > b.length ) { return -1 } return 0 })
标签:for let lse 排列 get col cti lis array
原文地址:https://www.cnblogs.com/web-Development/p/12342062.html