comb=function(a,n){
var ids=new Array(n).fill(0).map((i,ind)=>ind);
var res=[];
//console.log(indexes);
var evs="";
for(i in ids)
evs+=`for(ids[${i}]=((ids[${i}-1]==null)?(-1):ids[${i}-1])+1;ids[${i}]<=a.length-n+${i};ids[${i}]++){\n`;
evs+=`res.push(a.filter( (ii,ind)=>(ids.indexOf(ind)!=-1) ));\n`;
evs+="}\n".repeat(n);
console.log(evs);
eval(evs);
return (res);
}