📅  最后修改于: 2022-03-11 15:02:40.209000             🧑  作者: Mango
function primeFactors(n){
var factors = [],
divisor = 2;
while(n>=2){
if(n % divisor == 0){
factors.push(divisor);
n= n/ divisor;
}
else{
divisor++;
}
}
//contains duplicates, you should Array.prototype.filter() them out
return factors;
}