📜  阶乘函数 javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:40.655000             🧑  作者: Mango

代码示例6
var factorial = 1;
function myfact(fact) {
    for (let i = 1; i <= 5; i++) {
        factorial = factorial * i;
    }
    return factorial;
}
console.log(myfact(factorial))
 // Output: 120