<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<title>prime</title>
</head>
<body>
<script>
// 分解质因数
var factor=[];
var divident=[];
function num(num){
for(var i=2;i<num;i++){
if(num%i==0){
factor.push(i);
divident.push(num);
num=num/i;
i=i-1;
}
}
factor.push(num);
}
num(12);
console.log(factor);
console.log(divident);
</script>
</body>
</html>