Discuss / JavaScript / zuoye

zuoye

Topic source

DylanLang

#1 Created at ... [Delete] [Delete and Lock User]
  return  arr.filter(function(x){
        if(x===1){
            return;
        }
        var len=x/2,i=2;
        while(i<=len&&(x%i!==0)){
            i++;
        }
        if(i>len){
            return x;
        }
    });

  • 1

Reply