Discuss / JavaScript / 作业

作业

Topic source

Jemair丶

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

  • 1

Reply