1 var base = {} 2 //组合 3 base.C = function(arr, num){ 4 var r=[]; 5 (function f(t,a,n){ 6 if (n==0) return r.push(t); 7 for (var i=0,l=a.length; i<=l-n; i++){ 8 f(t.concat(a[i]), a.slice(i+1), n-1); 9 }10 })([],arr,num);11 return r;12 }
没听说过能把JS编辑没C#的,只能是你把JS里表达的算法理清楚了用C#写