Discuss / JavaScript / 打卡交作业

打卡交作业

Topic source

GodKeen粉

#1 Created at ... [Delete] [Delete and Lock User]
function flag(x){
        for(let i = 1;i <= x;i++){
            if((x%i === 0 && i !== 1 && i !== x) || 1 === x)return false;
        }
        return true;
    }
    return arr.filter(function (x){
        return x && flag(x);
    })  


  • 1

Reply