<body>
<!-- 输入90,输出 90 = 2*3*3*5 -->
<!-- 从2开始 90 = 2 * 45
3 90 = 2 *
-->
<script>
let x = 90
var s = '90' + '='
for (let i = 2; i < 90; i++) {
if (x % i === 0) { //能整除 90 45
s += i + '*' //i=2 //i=3
x = x / i //x = 45 15
i--;
} else {
continue;
}
//console.log(i) //i = 2
//console.log(s)
}
//去除最后一个*
if (s.endsWith('*')) {
s = s.slice(0, s.length - 1)
}
console.log(s)
//90%1
</script>
</body>