Discuss / JavaScript / 答案

答案

Topic source

木落绕指

#1 Created at ... [Delete] [Delete and Lock User]
return arr.filter(function(x){
  if(x === 1){
    return false;
  }else{ 
     for(var i=2;i<x;i++){
       if(x % i === 0){
         return false;
       }
     }
   }
  return true;
});

  • 1

Reply